@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins-semibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
/* Central AutoMind — tela no visual do WhatsApp (o mesmo do Pombo): trilho de ícones, lista de conversas à
   esquerda e a conversa com papel de parede à direita. No celular (até 599 px) é uma tela por vez, como no app.
   Layout WhatsApp aprovado, com fontes locais e tokens do Brand Kit AutoMind 2026. */

:root {
  color-scheme: dark;
  --bg: #0C0C0C;
  --pane: #0C0C0C;
  --surface: #161616;
  --surface-2: #414141;
  --soft: #161616;
  --hover: #161616;
  --sel: #414141;
  --line: #414141;
  --chatbg: #0B0B0B;
  --in: #161616;
  --out: #001F06;
  --head: #161616;
  --input: #414141;
  --text: #D3D3D3;
  --muted: #9E9E9E;
  --accent: #37FF5C;
  --accent-ink: #0C0C0C;
  --accent-soft: #001F06;
  --tick: #37FF5C;
  --topbar: #161616;
  --topbar-on: #37FF5C;
  --topbar-mu: #9E9E9E;
  --danger: #FFA2A3;
  --danger-soft: rgba(255, 27, 31, .14);
  --warn: #ffbd8c;
  --warn-soft: rgba(255, 122, 27, .14);
  --info: #cfa2ff;
  --info-soft: rgba(137, 27, 255, .18);
  --org-adv360: #cfa2ff;
  --org-godinho: #ffbd8c;
  --org-automind: #37FF5C;
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --shadow-up: 0 2px 5px rgba(0, 0, 0, .35);
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%23fff' stroke-opacity='.035' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M18 22a8 8 0 1 1 3 6l-5 2 2-4'/%3E%3Ccircle cx='86' cy='26' r='7'/%3E%3Cpath d='M60 58l4 8 9 1-7 6 2 9-8-5-8 5 2-9-7-6 9-1z'/%3E%3Cpath d='M16 84h18M25 75v18'/%3E%3Crect x='80' y='80' width='18' height='14' rx='3'/%3E%3Cpath d='M98 50q6-8 12 0'/%3E%3C/svg%3E");
  --radius: 8px;
  --radius-sm: 8px;
  --tap: 40px;
  --font-title: "Bricolage Grotesque", system-ui, sans-serif;
  --font-text: "Poppins", system-ui, sans-serif;
}

/* Tema claro: escolhido na tela, ou o do aparelho quando a pessoa não escolheu. */
:root[data-theme="claro"] {
  color-scheme: light;
  --bg: #D3D3D3;
  --pane: #ffffff;
  --surface: #ffffff;
  --surface-2: #D3D3D3;
  --soft: #D3D3D3;
  --hover: #D3D3D3;
  --sel: #D3D3D3;
  --line: #D3D3D3;
  --chatbg: #FFFFFF;
  --in: #ffffff;
  --out: #37FF5C;
  --head: #D3D3D3;
  --input: #ffffff;
  --text: #0C0C0C;
  --muted: #6B6B6B;
  --accent: #007215;
  --accent-ink: #ffffff;
  --accent-soft: #D3D3D3;
  --topbar: #007215;
  --topbar-on: #ffffff;
  --topbar-mu: rgba(255, 255, 255, .72);
  --danger: #9F0003;
  --danger-soft: rgba(255, 27, 31, .09);
  --warn: #893900;
  --warn-soft: rgba(255, 122, 27, .14);
  --info: #4d009f;
  --info-soft: rgba(137, 27, 255, .10);
  --org-adv360: #4d009f;
  --org-godinho: #893900;
  --org-automind: #007215;
  --shadow-up: 0 2px 5px rgba(11, 20, 26, .18);
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%23000' stroke-opacity='.045' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M18 22a8 8 0 1 1 3 6l-5 2 2-4'/%3E%3Ccircle cx='86' cy='26' r='7'/%3E%3Cpath d='M60 58l4 8 9 1-7 6 2 9-8-5-8 5 2-9-7-6 9-1z'/%3E%3Cpath d='M16 84h18M25 75v18'/%3E%3Crect x='80' y='80' width='18' height='14' rx='3'/%3E%3Cpath d='M98 50q6-8 12 0'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #D3D3D3;
    --pane: #ffffff;
    --surface: #ffffff;
    --surface-2: #D3D3D3;
    --soft: #D3D3D3;
    --hover: #D3D3D3;
    --sel: #D3D3D3;
    --line: #D3D3D3;
    --chatbg: #FFFFFF;
    --in: #ffffff;
    --out: #37FF5C;
    --head: #D3D3D3;
    --input: #ffffff;
    --text: #0C0C0C;
    --muted: #6B6B6B;
    --accent: #007215;
    --accent-ink: #ffffff;
    --accent-soft: #D3D3D3;
    --topbar: #007215;
    --topbar-on: #ffffff;
    --topbar-mu: rgba(255, 255, 255, .72);
    --danger: #9F0003;
    --danger-soft: rgba(255, 27, 31, .09);
    --warn: #893900;
    --warn-soft: rgba(255, 122, 27, .14);
    --info: #4d009f;
    --info-soft: rgba(137, 27, 255, .10);
    --org-adv360: #4d009f;
    --org-godinho: #893900;
    --org-automind: #007215;
    --shadow-up: 0 2px 5px rgba(11, 20, 26, .18);
    --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%23000' stroke-opacity='.045' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M18 22a8 8 0 1 1 3 6l-5 2 2-4'/%3E%3Ccircle cx='86' cy='26' r='7'/%3E%3Cpath d='M60 58l4 8 9 1-7 6 2 9-8-5-8 5 2-9-7-6 9-1z'/%3E%3Cpath d='M16 84h18M25 75v18'/%3E%3Crect x='80' y='80' width='18' height='14' rx='3'/%3E%3Cpath d='M98 50q6-8 12 0'/%3E%3C/svg%3E");
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 35%, transparent) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 35%, transparent); border-radius: 3px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; overflow: hidden; }
body {
  display: flex; flex-direction: column; height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14.2px/1.45 var(--font-text);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
#app { flex: 1; min-height: 0; }
h1, h2, h3 { font-family: var(--font-title); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.25rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1:focus-visible { outline: none; }

.skip {
  position: absolute; left: 12px; top: -64px; z-index: 50;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.boot { padding: 28vh 24px 0; text-align: center; color: var(--muted); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: 24px;
  border: 0; background: var(--soft); color: var(--text);
  font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, filter .15s ease;
}
.btn:hover { filter: brightness(.96); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--soft); color: var(--text); filter: none; }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; border-radius: 50%; }

/* Marca */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-title); font-weight: 700; font-size: 1.0625rem; letter-spacing: -.01em; color: var(--text); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand small { display: block; font: 500 .75rem/1.2 var(--font-text); color: var(--muted); letter-spacing: 0; }

/* Entrada (login) */
.login { height: 100%; overflow: auto; display: grid; place-items: center; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); background: var(--chatbg) var(--wall) repeat; background-size: 240px; }
.login-card { width: min(420px, 100%); display: grid; gap: 20px; padding: 28px 24px; background: var(--pane); border-radius: 12px; box-shadow: var(--shadow-up); }
.login-card h1 { font-size: 1.5rem; }
.login-lead { color: var(--muted); }
.login-rules { margin: 0; padding: 14px 16px; list-style: none; display: grid; gap: 8px; background: var(--soft); border-radius: var(--radius); }
.login-rules li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: baseline; }
.login-rules li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: translateY(-1px); }

/* Avisos dentro da página */
.notice { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--pane); box-shadow: var(--shadow); }
.notice svg { grid-row: span 3; margin-top: 2px; }
.notice strong { font-family: var(--font-title); font-weight: 600; }
.notice-error { background: var(--danger-soft); box-shadow: none; }
.notice-error svg, .notice-error strong { color: var(--danger); }
.notice-warn { background: var(--warn-soft); box-shadow: none; }
.notice-warn svg, .notice-warn strong { color: var(--warn); }
.notice-ok { background: var(--accent-soft); box-shadow: none; }
.notice-ok svg, .notice-ok strong { color: var(--accent); }
.notice .actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.trace { font: 500 .75rem/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); user-select: all; }

/* Avisos rápidos (somem sozinhos) */
.toasts { order: -1; flex: none; display: grid; gap: 8px; max-height: 25dvh; overflow-y: auto; padding: 8px 12px; background: var(--pane); }
.toasts:empty { display: none; }
.toast { pointer-events: auto; justify-self: center; width: min(520px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 12px 12px 16px; border-radius: var(--radius); background: var(--pane); box-shadow: var(--shadow-up); }
.toast strong { font-family: var(--font-title); }
.toast p { grid-column: 1; color: var(--muted); }
.toast .btn { grid-column: 2; grid-row: 1 / span 3; }
.toast-error { box-shadow: inset 4px 0 0 var(--danger), var(--shadow-up); }
.toast-error strong { color: var(--danger); }

/* Casca: trilho de ícones | lista de conversas | conversa (como o WhatsApp Web e o Pombo) */
.app { display: grid; grid-template-columns: 68px 380px minmax(0, 1fr); height: 100%; overflow: hidden; max-width: 1680px; margin: 0 auto; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 0; background: var(--pane); border-right: 1px solid var(--line); }
.rail img { width: 30px; height: 30px; margin-bottom: 14px; opacity: .9; }
.rb { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--muted); background: transparent; border: 0; cursor: pointer; text-decoration: none; }
.rb:hover { background: var(--soft); color: var(--text); }
.rb.on { background: var(--accent-soft); color: var(--accent); }
.rail .esp { flex: 1; }
.side { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--pane); border-right: 1px solid var(--line); }
.chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--chatbg) var(--wall) repeat; background-size: 240px; }
.chat > .page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat > .page:not(.conv):not(.home) { padding: 24px; justify-content: center; }
.page { display: grid; gap: 12px; align-content: start; }
.connect-page { width: min(100%, 720px); margin: auto; padding: clamp(18px, 4vw, 40px); }
.connect-card { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 16px; padding: clamp(20px, 4vw, 32px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--pane); box-shadow: var(--shadow); }
.connect-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.connect-card > .page-head, .connect-status, .connect-card > .notice, .connect-card > .muted, .connect-qr-box, .connect-steps, .connect-actions, .connect-note { grid-column: 1 / -1; }
.connect-card .page-head { gap: 4px; }
.connect-card .page-head h1 { font-size: clamp(24px, 4vw, 32px); }
.connect-status { display: grid; gap: 7px; padding: 14px 16px; border-radius: var(--radius); background: var(--soft); }
.connect-status .eyebrow { font-size: 10px; letter-spacing: .09em; color: var(--muted); }
.connect-state { font-size: 18px; }
.connect-card[data-state="connected"] .connect-state { color: var(--accent); }
.connect-qr-box { display: grid; place-items: center; padding: 18px; border-radius: var(--radius); background: #fff; }
.connect-qr { display: block; width: min(100%, 280px); aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; }
.connect-steps { display: grid; gap: 8px; padding-left: 22px; color: var(--muted); }
.connect-steps strong { color: var(--text); }
.connect-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.connect-note { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.page-head { display: grid; gap: 2px; }
.page-head p { color: var(--muted); }

/* Tela inicial, sem conversa aberta (a "capa" do WhatsApp Web) */
.chat > .home { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; background: var(--head); border-bottom: 6px solid var(--accent); }
.home img { align-self: center; justify-self: center; width: 72px; height: 72px; opacity: .85; margin-bottom: 8px; }
.home h1 { font-size: 1.75rem; font-weight: 300; letter-spacing: 0; }
.home p { color: var(--muted); max-width: 440px; }
.home .small { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 500; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.tag[data-org="adv360"]::before { background: var(--org-adv360); }
.tag[data-org="godinho"]::before { background: var(--org-godinho); }
.tag[data-org="automind"]::before { background: var(--org-automind); }
.tag-plain::before { display: none; }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--soft), var(--line), var(--soft)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.w40 { width: 40%; } .skeleton.w70 { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { padding: 22px 18px; text-align: center; color: var(--muted); background: var(--pane); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; gap: 6px; justify-items: center; }
.empty strong { color: var(--text); font-family: var(--font-title); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Fila na coluna da esquerda (C-D02) */
.side > .page { display: flex; flex-direction: column; gap: 0; height: 100%; min-height: 0; }
.page-head-row { grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px 14px 6px; }
.page-head-row h1 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.page-head-row p { font-size: 12.5px; }
.head-actions { display: flex; align-items: center; gap: 4px; }
.head-actions .small { font-size: 11.5px; }
.chips { display: flex; gap: 5px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 0; background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.chip:hover { background: var(--hover); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.chip-count { font-variant-numeric: tabular-nums; font-size: 11px; opacity: .85; }
.chip-count:empty { display: none; }
.chip[data-org]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip[data-org="adv360"]::before { background: var(--org-adv360); }
.chip[data-org="godinho"]::before { background: var(--org-godinho); }
.chip[data-org="automind"]::before { background: var(--org-automind); }
.side > .page > div:empty { display: none; }
.side > .page > .notice, .side > .page > div > .notice { margin: 0 14px 8px; }

.groups { flex: 1; min-height: 0; overflow: auto; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.side > .page > .empty { margin: 8px 14px; }
.groups > .empty { margin: 8px 6px; box-shadow: none; background: var(--soft); }
.group { display: grid; gap: 0; }
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 10px 4px; }
.group-head h2 { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.group-head .small { font-size: 11.5px; }
.group-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; color: inherit; text-decoration: none; }
a.row:hover { background: var(--hover); }
a.row.on, a.row[aria-current="page"] { background: var(--sel); }
a.row:focus-visible { outline-offset: -2px; border-radius: 14px; }
.avatar { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: #fff; font-size: 16px; font-weight: 600; }
.av-c0 { background: #007215; } .av-c1 { background: #414141; } .av-c2 { background: #414141; } .av-c3 { background: #414141; }
.av-c4 { background: #414141; } .av-c5 { background: #414141; } .av-c6 { background: #414141; } .av-c7 { background: #414141; }
.row-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.row-main .skeleton + .skeleton { margin-top: 6px; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-name { flex: 1; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }
.row-time { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-waiting .row-time { color: var(--accent); font-weight: 600; }
.row-preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-waiting .row-preview { color: var(--text); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; }
.row-meta .small { font-size: 11px; }
.badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge-accent { background: var(--accent); color: var(--accent-ink); border-radius: 99px; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--soft); color: var(--text); }

/* Conversa (C-D03) */
.btn-small { min-height: 32px; padding: 0 12px; font-size: .8125rem; }
.conv { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: 0; }
.conv-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--head); border-bottom: 1px solid var(--line); }
.conv-head .avatar { flex-basis: 40px; width: 40px; height: 40px; font-size: 15px; }
.conv-title { flex: 1; min-width: 0; display: grid; gap: 1px; }
.conv-title h1 { font-size: 15px; font-weight: 600; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-title p { display: flex; align-items: center; gap: 4px 8px; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.conv-title p > span { overflow: hidden; text-overflow: ellipsis; }
.conv-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.seg { flex: none; display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 11px; border: 0; border-radius: 9px; background: transparent; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button[aria-selected="true"] { background: var(--pane); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.conv > .turn { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 16px; background: var(--head); border-bottom: 1px solid var(--line); font-size: 13px; }
.conv > .turn:empty { display: none; }
.conv > .turn > .notice { flex: 1 1 100%; }
.conv > .tag-box { flex: none; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 16px; max-height: 45%; overflow: auto; }
.conv-problem:not(:empty) { flex: none; padding: 10px 16px; }
.conv-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.msgs-scroll { flex: 1 1 auto; min-height: 120px; overflow: auto; padding: 18px 7% 10px; display: flex; flex-direction: column; }
.conv-older { align-self: center; margin-bottom: 8px; background: var(--pane); box-shadow: var(--shadow); }
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.msgs > .empty { align-self: center; margin-top: 24px; }
.day { display: flex; justify-content: center; margin: 12px 0; }
.day span { background: var(--pane); color: var(--muted); font-size: 12.5px; font-weight: 500; padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow); text-transform: uppercase; letter-spacing: .02em; }
/* O rabinho do balão fica fora dele: o padding da linha dá o espaço que a contenção de pintura não corta. */
.msg { display: flex; padding: 0 8px; content-visibility: auto; contain-intrinsic-size: auto 44px; }
.msg.first { margin-top: 10px; }
.msg-out { justify-content: flex-end; }
.bubble { position: relative; display: flow-root; max-width: 64%; padding: 6px 9px 8px; border-radius: 8px; background: var(--in); box-shadow: var(--shadow); font-size: 14.2px; line-height: 1.38; }
.msg-out .bubble { background: var(--out); }
.msg-in.first .bubble { border-top-left-radius: 0; }
.msg-in.first .bubble::before { content: ""; position: absolute; top: 0; left: -8px; border-style: solid; border-width: 0 8px 10px 0; border-color: transparent var(--in) transparent transparent; }
.msg-out.first .bubble { border-top-right-radius: 0; }
.msg-out.first .bubble::before { content: ""; position: absolute; top: 0; right: -8px; border-style: solid; border-width: 0 0 10px 8px; border-color: transparent transparent transparent var(--out); }
.msg-author { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg-body { display: inline; white-space: pre-wrap; }
.msg-meta { float: right; display: inline-flex; align-items: center; gap: 4px; margin: 7px 0 -5px 10px; font-size: 10.5px; line-height: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.delivery-ok { color: var(--tick); font-weight: 600; }
.delivery-warn { color: var(--warn); font-weight: 600; }
.delivery-danger { color: var(--danger); font-weight: 600; }

.att-wrap { display: grid; gap: 4px; margin-bottom: 4px; }
.att { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); color: inherit; text-decoration: none; }
a.att:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.att-name { font-weight: 600; }
.att-blocked { background: var(--danger-soft); }
.att-blocked svg { color: var(--danger); }
.att-failed { background: var(--warn-soft); }
.att-image { display: block; }
.att-image img { display: block; max-width: 100%; width: 280px; height: 200px; object-fit: cover; border-radius: 6px; background: var(--soft); } /* tamanho fixo: a conversa não pula quando a imagem termina de carregar */
.att-wrap audio { width: min(300px, 100%); height: 40px; }
.att-wrap video { max-width: 100%; width: 320px; border-radius: 6px; background: #000; }
.att-text { display: grid; gap: 2px; padding-left: 10px; border-left: 3px solid color-mix(in srgb, var(--text) 18%, transparent); }
.att-text:empty { display: none; }
.att-text .btn { justify-self: start; }

/* O rascunho fica onde o WhatsApp põe a caixa de escrever: embaixo, colado na conversa. */
.draft-box { display: grid; gap: 8px; padding: 10px 16px; background: var(--head); }
.conv-panel > .draft-box { flex: none; max-height: 55%; overflow: auto; border-top: 1px solid var(--line); }
.draft-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.draft-head strong { font-family: var(--font-title); font-weight: 600; }
.jump { position: sticky; bottom: 10px; align-self: flex-end; margin-top: 8px; border-radius: 99px; background: var(--pane); color: var(--text); box-shadow: var(--shadow-up); }
.jump svg { color: var(--accent); }

#painel-linha { overflow: auto; padding: 18px 7%; gap: 10px; }
#painel-linha > p { align-self: center; background: var(--pane); padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow); text-align: center; }
.events { list-style: none; margin: 0; padding: 8px 18px 8px 26px; display: grid; background: var(--pane); border-radius: var(--radius); box-shadow: var(--shadow); }
.event { display: grid; gap: 2px; padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.event::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.event-ok::before { background: var(--accent); }
.event-warn::before { background: var(--warn); }
.event-danger::before { background: var(--danger); }
.event-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.event-text { font-weight: 600; }
#painel-linha > .btn { align-self: center; width: auto; background: var(--pane); }

/* Rascunho (C-D04) */
.draft-box:empty { display: none; }
.draft-text { width: 100%; min-height: 132px; resize: vertical; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; line-height: 1.5; }
.draft-text:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.draft-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.draft-box .notice { background: var(--surface); }
.draft-box .notice-warn { background: var(--warn-soft); }
.draft-box .notice-ok { background: var(--accent-soft); }
.flags { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; font-size: .9375rem; }
.notice .flags { grid-column: 2; }
.compare { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.compare-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
.compare-side { display: grid; gap: 4px; align-content: start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.compare del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; border-radius: 3px; }
.compare ins { background: var(--accent-soft); color: var(--accent); text-decoration: none; font-weight: 600; border-radius: 3px; }
.btn[disabled] { pointer-events: none; }
@media (min-width: 720px) { .compare-grid { grid-template-columns: 1fr 1fr; } }

/* Aprovação em dois passos e estado do envio (C-D05) */
.approve-card { display: grid; gap: 12px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface); border: 2px solid var(--accent); }
.approve-card:focus-visible { outline: none; } /* a borda verde já marca o cartão; sem anel dobrado */
.approve-title { font-family: var(--font-title); font-size: 1.0625rem; }
.approve-list { margin: 0; display: grid; grid-template-columns: 1fr; gap: 4px; }
.approve-list dt { font-size: .8125rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
.approve-list dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.approve-body { width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.approve-files { margin: 0; padding-left: 20px; }
.send-card { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border-left: 4px solid var(--muted); }
.send-card .btn { justify-self: start; margin-top: 4px; }
.send-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.send-head strong { font-family: var(--font-title); }
.send-ok { border-left-color: var(--accent); }
.send-ok strong { color: var(--accent); }
.send-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.send-warn strong { color: var(--warn); }
.send-danger { border-left-color: var(--danger); background: var(--danger-soft); }
.send-danger strong { color: var(--danger); }
@media (min-width: 720px) { .approve-list { grid-template-columns: 90px 1fr; gap: 8px 12px; align-items: start; } .approve-list dt { margin-top: 2px; } }
.approve-files li { margin: 2px 0; }
.approve-files li > span { white-space: nowrap; }
.approve-files a { display: block; width: fit-content; padding: 4px 0; }
/* Revisão de 12/11: nome de contato, de arquivo e de autor vem de fora (o cliente escolhe). Isolado, um caractere
   de direção de texto dentro do nome não embaralha o que está ao lado (telefone, hora, botões). */
.row-name, .conv-title h1, .conv-title p > span, .msg-author, .att-name, .who-name, .brand small { unicode-bidi: isolate; }

/* Etiquetar (C-D07) */
.tag-box { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); border: 1px solid var(--line); }
.tag-box[hidden] { display: none; }
.tag-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.tag-line p { margin: 0; flex: 1 1 220px; }
.tag-title { font-family: var(--font-title); }
.tag-group { margin: 0; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); display: grid; gap: 2px; min-width: 0; }
.tag-group legend { padding: 0 4px; }
.tag-option { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.tag-option:hover { background: var(--surface-2); }
.tag-option input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.tag-box .notice { background: var(--surface); }
.tag-confirm:focus-visible { outline: none; }

/* A vez (C-D06) */
.turn { display: grid; gap: 8px; }
.turn-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.turn-clock { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.turn-clock-expired { color: var(--danger); font-weight: 600; }
.turn-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.turn-reason, .turn-select { min-height: var(--tap); padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; flex: 1 1 220px; min-width: 0; }
.turn .notice { background: var(--surface); }
.turn .notice-warn { background: var(--warn-soft); }

/* Composer: o texto do rascunho no fundo branco de caixa de escrever do WhatsApp. */
.draft-text { background: var(--input); border-color: transparent; border-radius: 8px; }
.turn-reason, .turn-select { background: var(--input); }

/* Rascunho: pilha de cartões (Sugestão, avisos, conferência) e, embaixo, a caixa de mensagem fixa do WhatsApp. */
.conv-panel > .draft-box { display: flex; flex-direction: column; gap: 0; max-height: none; overflow: visible; padding: 0; background: transparent; border: 0; }
.draft-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-height: 45vh; overflow: auto; padding: 8px 7% 4px; }
.draft-stack:empty { display: none; }
.draft-stack > .notice, .draft-stack > p { margin: 0; }
.draft-stack > p.small { background: var(--pane); padding: 4px 10px; border-radius: 8px; justify-self: center; text-align: center; }
/* Cartão "Sugestão" do Pombo */
.suggest { display: grid; gap: 6px; padding: 10px 12px; background: var(--pane); border-radius: 14px; box-shadow: var(--shadow-up); }
.suggest-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.suggest-head > .more { margin-left: auto; }
.suggest-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.suggest-row { display: flex; justify-content: flex-end; padding-right: 8px; }
.suggest-bubble { max-width: 88%; background: var(--out); border-top-right-radius: 0; max-height: 9.5em; overflow: auto; }
.suggest-bubble::before { content: ""; position: absolute; top: 0; right: -8px; border-style: solid; border-width: 0 0 10px 8px; border-color: transparent transparent transparent var(--out); }
.suggest-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.suggest-actions .btn { min-height: 36px; padding: 0 16px; font-size: .875rem; font-weight: 600; border-radius: 10px; }
.suggest-actions .btn:not(.btn-primary) { background: var(--soft); color: var(--text); box-shadow: none; }
.suggest-actions .more { margin-left: auto; }
.suggest > p.small { margin: 0; }
/* Caixa de mensagem fixa: clipe + campo + ✨ numa pílula, e o botão redondo verde ao lado */
.composer { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 6px; padding: 6px 12px 8px; background: var(--head); border-top: 1px solid var(--line); }
.composer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 0; border-left: 3px solid var(--accent); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-field { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; min-height: 46px; padding: 0 6px; background: var(--input); border-radius: 24px; }
.composer-off { opacity: .85; }
.composer-hint { flex: 1; min-width: 0; align-self: center; padding: 6px 4px; color: var(--muted); font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-icon { flex: none; display: grid; place-items: center; width: 40px; height: 46px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 50%; }
.composer-icon:disabled { cursor: default; opacity: .55; }
.composer-ai:not(:disabled) { color: var(--accent); }
.composer-go { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer; box-shadow: var(--shadow); }
.composer-go:disabled { cursor: default; }
.composer-go:focus-visible, .composer-icon:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.composer .draft-text, .draft-box .composer .draft-text { flex: 1; min-height: 0; height: auto; max-height: 160px; resize: none; padding: 12px 4px; border: 0; border-radius: 0; background: transparent; line-height: 1.35; overflow-y: auto; }
.composer .draft-text:focus-visible { outline: none; }
.composer-field:focus-within { box-shadow: 0 0 0 2px var(--accent); }
/* Ticks do WhatsApp */
.tick { display: inline-flex; color: var(--muted); }
.tick-read { color: var(--tick); }
/* Faixa da vez: pílulas segmentadas como os modos do Pombo + menu ⋯ */
.conv > .turn { padding: 6px 16px; gap: 6px 10px; }
.turn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--soft); border-radius: 12px; }
.pill { min-height: 30px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: .8125rem; cursor: pointer; white-space: nowrap; }
.pill:hover { color: var(--text); }
.pill-on, .pill:focus-visible { background: var(--pane); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.pill:disabled { opacity: .55; cursor: default; }
.turn-actions .btn { min-height: 32px; padding: 0 12px; font-size: .8125rem; border-radius: 99px; }
/* Menu ⋯ */
.more { position: relative; display: inline-flex; }
.more-btn { width: 34px; height: 34px; min-height: 34px; color: var(--muted); }
.more-btn svg { fill: currentColor; }
.pills { box-shadow: 0 0 0 1px var(--line); }
.more-menu { position: fixed; inset: auto; margin: 0; z-index: 30; min-width: 230px; max-width: min(320px, 90vw); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 6px 0; color: var(--text); background: var(--pane); border: 0; border-radius: 10px; box-shadow: var(--shadow-up), 0 0 0 1px var(--line); }
.more-menu:popover-open { display: grid; }
.inbox-search { width: 100%; min-height: 44px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--pane); color: var(--text); font: inherit; }
.more-item { text-align: left; padding: 10px 16px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .875rem; cursor: pointer; }
.more-item:hover, .more-item:focus-visible { background: var(--soft); outline: none; }
.more-item:disabled { color: var(--muted); cursor: default; }
.more-danger { color: var(--danger); }

/* Tablet e notebook pequeno (600–1100 px) */
@media (max-width: 1100px) and (min-width: 600px) {
  .app { grid-template-columns: 56px clamp(240px, 38vw, 340px) minmax(0, 1fr); }
  .rb { width: 40px; height: 40px; }
  .avatar { flex-basis: 42px; width: 42px; height: 42px; }
  .bubble { max-width: 88%; }
  .msgs-scroll, #painel-linha { padding: 10px 3%; }
  .conv-head, .conv > .turn, .conv > .tag-box { padding-left: 12px; padding-right: 12px; }
  .conv-head { flex-wrap: wrap; }
}

/* Celular (até 599 px): uma tela por vez, barra verde no topo como o app do WhatsApp. */
@media (max-width: 599px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; justify-content: space-around; gap: 0; padding: calc(4px + env(safe-area-inset-top)) 2px 0; border: 0; background: var(--topbar); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
  .rail .esp, .rail img { display: none; }
  .rail .rb { flex: 1; width: auto; height: 46px; border-radius: 0; color: var(--topbar-mu); }
  .rail .rb:hover { background: transparent; color: var(--topbar-on); }
  .rail .rb.on { background: transparent; color: var(--topbar-on); box-shadow: inset 0 -3px 0 var(--topbar-on); }
  .app.abrir { grid-template-rows: minmax(0, 1fr); }
  .app.abrir .rail, .app.abrir .side { display: none; }
  .app:not(.abrir) .chat { display: none; }
  .bubble { max-width: 86%; }
  .msgs-scroll, #painel-linha { padding: 12px 4%; }
  .conv-head { flex-wrap: wrap; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; gap: 8px 10px; }
  .conv-head .seg { order: 3; flex: 1 1 100%; }
  .conv-head .seg button { flex: 1; }
  .conv > .turn, .conv > .tag-box { padding: 8px 10px; }
  .draft-stack { padding: 6px 3% 4px; max-height: 42vh; }
  .composer { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .composer-row { gap: 6px; }
  .conv > .turn { padding: 6px 10px; gap: 4px; }
  .turn-line .btn-small { min-height: 28px; }
  .pill { padding: 0 10px; }
  .suggest-actions .btn { padding: 0 12px; }
  .draft-actions { flex-wrap: wrap; }
  .turn-line { font-size: 12.5px; }
  input, select, textarea { font-size: 16px; }
}

.rail > img, .brand img, .home > img { background: #0C0C0C; border-radius: 6px; padding: 3px; object-fit: contain; }
.more-item { display: flex; align-items: center; gap: 8px; min-height: 44px; }
