/* ==========================================================================
   Shark · design system
   Cores só por tokens (claro/escuro). Tema: segue o sistema; o botão do menu fixa claro ou escuro.
   ========================================================================== */
:root {
    color-scheme: light;
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #f7f9fa;
    --hover: #f5f7f8;
    --line: #e4e8ec;
    --line-2: #eef1f3;
    --ink: #0f172a;
    --ink-2: #4b5a6b;
    --ink-3: #8a97a6;
    --brand: var(--brand);
    --brand-ink: var(--brand-ink);
    --brand-soft: #e6f6f0;
    --on-brand: #ffffff;
    --rail: #0b1f1a;
    --rail-ink: #8fa7a0;
    --wa-bg: #efeae2;
    --wa-dots: rgba(84, 101, 111, .16);
    --wa-in: #ffffff;
    --wa-out: #d9fdd3;
    --wa-meta: #667781;
    --wa-link: #027eb5;
    --wa-author: var(--brand-ink);
    --composer: #f0f2f5;
    --composer-field: #ffffff;
    --tick: #53bdeb;
    --t-ag: #be123c; --t-ag-bg: #fff1f2; --t-ag-c: #e11d48;
    --t-pe: #b45309; --t-pe-bg: #fffbeb; --t-pe-c: #f59e0b;
    --t-ca: #1d4ed8; --t-ca-bg: #eff6ff; --t-ca-c: #3b82f6;
    --t-ap: #047857; --t-ap-bg: #ecfdf5; --t-ap-c: #10b981;
    --av-l: 92%; --av-s: 62%; --av-ink-l: 30%;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 28px rgba(15, 23, 42, .07);
    --bubble-shadow: 0 1px .5px rgba(11, 20, 26, .13);
    --radius: 12px;
    --ai-1: #7c3aed; --ai-2: #06b6d4; --ai-3: #22c55e;
    --ai-grad: linear-gradient(120deg, var(--ai-1), var(--ai-2) 55%, var(--ai-3));
    --ai-ink: #0d1b2a;
    --ai-soft-ink: #6d28d9;
}

/* Tema escuro (inspirado no WhatsApp Web escuro): fixado pelo botão... */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b141a; --surface: #111b21; --surface-2: #202c33; --surface-3: #182229; --hover: #1b2830;
    --line: #26343d; --line-2: #1d2a32; --ink: #e9edef; --ink-2: #aebac1; --ink-3: #7c8c95;
    --brand-ink: #C4B5FD; --brand-soft: rgba(139, 92, 246, .16); --rail: #070d11; --rail-ink: #7c8c95;
    --wa-bg: #0b141a; --wa-dots: rgba(134, 150, 160, .09); --wa-in: #202c33; --wa-out: #005c4b; --wa-meta: #9fb0b9;
    --wa-link: #53bdeb; --wa-author: #53e0b8; --composer: #1a252c; --composer-field: #2a3942;
    --t-ag: #fda4af; --t-ag-bg: rgba(244, 63, 94, .16); --t-ag-c: #fb7185;
    --t-pe: #fcd34d; --t-pe-bg: rgba(245, 158, 11, .15); --t-pe-c: #fbbf24;
    --t-ca: #93c5fd; --t-ca-bg: rgba(59, 130, 246, .18); --t-ca-c: #60a5fa;
    --t-ap: #6ee7b7; --t-ap-bg: rgba(16, 185, 129, .16); --t-ap-c: #34d399;
    --av-l: 24%; --av-s: 30%; --av-ink-l: 78%;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
    --bubble-shadow: 0 1px .5px rgba(0, 0, 0, .35); --ai-ink: #0a1620; --ai-soft-ink: #c4b5fd;
}

/* ...ou automático, quando o sistema está no escuro e ninguém escolheu claro */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0b141a; --surface: #111b21; --surface-2: #202c33; --surface-3: #182229; --hover: #1b2830;
        --line: #26343d; --line-2: #1d2a32; --ink: #e9edef; --ink-2: #aebac1; --ink-3: #7c8c95;
        --brand-ink: #C4B5FD; --brand-soft: rgba(139, 92, 246, .16); --rail: #070d11; --rail-ink: #7c8c95;
        --wa-bg: #0b141a; --wa-dots: rgba(134, 150, 160, .09); --wa-in: #202c33; --wa-out: #005c4b; --wa-meta: #9fb0b9;
        --wa-link: #53bdeb; --wa-author: #53e0b8; --composer: #1a252c; --composer-field: #2a3942;
        --t-ag: #fda4af; --t-ag-bg: rgba(244, 63, 94, .16); --t-ag-c: #fb7185;
        --t-pe: #fcd34d; --t-pe-bg: rgba(245, 158, 11, .15); --t-pe-c: #fbbf24;
        --t-ca: #93c5fd; --t-ca-bg: rgba(59, 130, 246, .18); --t-ca-c: #60a5fa;
        --t-ap: #6ee7b7; --t-ap-bg: rgba(16, 185, 129, .16); --t-ap-c: #34d399;
        --av-l: 24%; --av-s: 30%; --av-ink-l: 78%;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
        --bubble-shadow: 0 1px .5px rgba(0, 0, 0, .35); --ai-ink: #0a1620; --ai-soft-ink: #c4b5fd;
    }
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13.5px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.i { flex: none; display: block; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); font-size: 12px; }
.center { text-align: center; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 16%, transparent); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }

/* ============ Estrutura: menu lateral + conteúdo ============ */
.app { display: grid; grid-template-columns: 60px minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 6px; z-index: 20; }
.logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; margin-bottom: 14px; background: var(--brand-grad); box-shadow: 0 6px 16px rgba(139, 92, 246, .35); }
.rail-items { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rail-items a, .rail-foot a, .rail-foot button { position: relative; width: 40px; height: 40px; border: 0; border-radius: 11px; display: grid; place-items: center; color: var(--rail-ink); background: none; transition: background .15s, color .15s; }
.rail-items a span, .rail-foot a span, .rail-foot button span { display: none; }
.rail-items a:hover, .rail-foot a:hover, .rail-foot button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-items a.on { background: rgba(34, 211, 238, .15); color: var(--gold); }
.rail [data-label]:hover::after { content: attr(data-label); position: absolute; left: 50px; top: 50%; transform: translateY(-50%); background: #0f172a; color: #fff; font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); z-index: 5; }
.rail .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--rail); }
.dot.on { background: #22c55e; }
.dot.off { background: #f43f5e; }
.rail-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.me { width: 34px; height: 34px; margin-top: 4px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; background: hsl(var(--h, 160) 40% 28%); color: hsl(var(--h, 160) 80% 90%); }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
    :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
}

/* ============ Elementos comuns ============ */
.avatar { --h: 160; flex: none; position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 50% var(--av-ink-l)); }
.avatar .i { width: 55%; height: 55%; opacity: .8; }
.avatar .badge { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: #e11d48; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.avatar .badge .i { width: 11px; height: 11px; opacity: 1; fill: currentColor; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.md { width: 38px; height: 38px; font-size: 14px; }
.avatar.xl { width: 76px; height: 76px; font-size: 26px; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 1; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip .i { width: 11px; height: 11px; }
.chip.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.t-aguardando { --c: var(--t-ag-c); background: var(--t-ag-bg); color: var(--t-ag); }
.t-pendente { --c: var(--t-pe-c); background: var(--t-pe-bg); color: var(--t-pe); }
.t-agendado { --c: var(--t-ca-c); background: var(--t-ca-bg); color: var(--t-ca); }
.t-aprovado { --c: var(--t-ap-c); background: var(--t-ap-bg); color: var(--t-ap); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; background: var(--brand); color: var(--on-brand); font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, box-shadow .15s, border-color .15s; }
.btn:hover { background: color-mix(in srgb, var(--brand) 85%, #000); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--hover); }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 9px; border: 0; background: none; display: grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { background: var(--brand-soft); color: var(--brand-ink); }

.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); outline: 0; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--ink-3); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
select.input { padding-right: 28px; }
.field-l { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.flash { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; font-size: 13px; }
.flash.ok { background: var(--t-ap-bg); color: var(--t-ap); }
.flash.err { background: var(--t-ag-bg); color: var(--t-ag); }
.flash.warn { background: var(--t-pe-bg); color: var(--t-pe); font-size: 12.5px; }

.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
.live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 4px; animation: pulse 2s infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); } 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ Caixa de entrada ============ */
.inbox { grid-template-columns: 60px 340px minmax(0, 1fr) auto; }
.pane { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; }
.pane-head h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.banner { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 8px 10px; border-radius: 10px; background: var(--t-ag-bg); color: var(--t-ag); font-size: 12.5px; font-weight: 500; }
.banner a { margin-left: auto; font-weight: 700; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 11px; height: 36px; border-radius: 9px; background: var(--surface-2); color: var(--ink-3); transition: box-shadow .15s, background .15s; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; height: 100%; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }

/* Filtros por etapa: pílulas compactas que quebram linha em vez de cortar */
.filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.filters button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 4px 0 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; transition: border-color .15s, background .15s, color .15s; }
.filters button:hover { border-color: color-mix(in srgb, var(--ink) 20%, transparent); color: var(--ink); }
.filters button span { display: inline-flex; align-items: center; gap: 5px; }
.filters button i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.filters button b { order: 2; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.filters button.on { border-color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 10%, var(--surface)); color: var(--ink); }
.filters button.on b { background: var(--c, var(--brand)); color: #fff; }
#chats { flex: 1; overflow-y: auto; padding: 4px 0; }
.row { display: flex; gap: 10px; margin: 0 6px; padding: 8px; border-radius: 10px; cursor: pointer; position: relative; color: inherit; transition: background .12s; }
.row:hover { background: var(--hover); }
.row.on { background: var(--brand-soft); }
.row .mid { flex: 1; min-width: 0; }
.line1, .line2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.line1 strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line1 time { flex: none; font-size: 11.5px; color: var(--ink-3); }
.row.unread .line1 time { color: #1fa855; font-weight: 600; }
.line2 { margin-top: 1px; }
.line2 small { display: flex; align-items: center; gap: 3px; min-width: 0; font-size: 12.5px; color: var(--ink-2); }
.line2 small span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .line2 small { color: var(--ink); font-weight: 500; }
.count { flex: none; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.line3 { display: flex; gap: 5px; margin-top: 5px; }
.list-empty { padding: 40px 24px; text-align: center; color: var(--ink-2); }
.list-empty .i { margin: 0 auto 10px; color: var(--ink-3); }
.sk { height: 62px; margin: 4px 10px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* Conversa (cara de WhatsApp) */
#chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wa-bg); }
#chat::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55; background-image: radial-gradient(var(--wa-dots) 1px, transparent 1.2px); background-size: 22px 22px; }
#chat > * { position: relative; }
#chat > .ag-reading { position: absolute; }
.chat-head { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 10px 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 2; }
.head-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.who { min-width: 0; }
.who strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#back { display: none; margin-left: -6px; }
#empty { margin: auto; padding: 24px; text-align: center; max-width: 360px; color: var(--ink-2); animation: fade .3s; }
.empty-art { width: 80px; height: 80px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
#empty h2 { margin: 0 0 6px; font-size: 17px; color: var(--ink); letter-spacing: -.01em; }
#empty p { margin: 0; }
#msgs { flex: 1; overflow-y: auto; padding: 12px max(4%, 14px) 8px; display: flex; flex-direction: column; }
.day { align-self: center; margin: 12px 0 6px; padding: 4px 11px; border-radius: 7px; background: var(--wa-in); color: var(--wa-meta); font-size: 11.5px; font-weight: 500; box-shadow: var(--bubble-shadow); }
.msg { position: relative; max-width: min(65%, 560px); margin-top: 2px; padding: 5px 8px 6px 9px; border-radius: 8px; background: var(--wa-in); color: var(--ink); align-self: flex-start; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; box-shadow: var(--bubble-shadow); animation: fade .18s; }
.msg.out { align-self: flex-end; background: var(--wa-out); }
.msg.tail { margin-top: 8px; }
.msg.tail.in { border-top-left-radius: 0; }
.msg.tail.out { border-top-right-radius: 0; }
.msg.tail::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.tail.in::before { left: -8px; background: var(--wa-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg.tail.out::before { right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg em { display: block; margin-bottom: 1px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--wa-author); }
.msg .txt { white-space: pre-wrap; }
.msg .txt::after { content: ""; display: block; clear: both; }
.msg .txt a { color: var(--wa-link); text-decoration: underline; }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 7px 0 -4px 12px; font-size: 10.5px; color: var(--wa-meta); white-space: nowrap; }
.tick { color: var(--wa-meta); }
.tk.read .tick { color: var(--tick); }
.msg.has-media { padding: 4px 4px 6px; }
.msg.has-media .txt { padding: 0 5px; }
.msg img, .msg video { display: block; max-width: min(320px, 100%); max-height: 340px; border-radius: 6px; background: var(--surface-2); }
.msg audio { display: block; width: 270px; max-width: 100%; margin: 4px; }
.doc { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 9px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 6%, transparent); font-weight: 500; }
.doc .i { color: #e11d48; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 10px; background: var(--composer); z-index: 2; }
.composer .field { flex: 1; display: flex; align-items: flex-end; min-height: 42px; padding: 3px 6px 3px 3px; border-radius: 22px; background: var(--composer-field); }
.composer .field .icon-btn { border-radius: 50%; }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; padding: 9px 6px; max-height: 140px; line-height: 1.4; color: var(--ink); }
.composer textarea::placeholder { color: var(--ink-3); }
.send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); transition: background .15s, transform .1s; }
.send .i { width: 17px; height: 17px; }
.send:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }
.send:active { transform: scale(.94); }
.composer.busy { opacity: .6; pointer-events: none; }

/* Painel do contato */
#info { display: none; width: 320px; flex-direction: column; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); animation: fade .2s; }
.show-info #info { display: flex; }
.info-head { display: flex; align-items: center; gap: 6px; height: 56px; flex: none; padding: 0 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.hero { padding: 20px 16px 16px; text-align: center; border-bottom: 1px solid var(--line-2); }
.hero .avatar { margin: 0 auto 10px; }
.hero h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.hero p { margin: 2px 0 10px; color: var(--ink-3); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.journey { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.label { margin: 0 0 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.steps, .steps-l { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.steps span { height: 5px; border-radius: 999px; background: var(--surface-2); }
.steps span.done { background: var(--brand); }
.steps-l { margin: 6px 0 8px; font-size: 10.5px; color: var(--ink-3); }
.steps-l .now { color: var(--ink); font-weight: 600; }
.facts { padding: 2px 16px 18px; }
.fact { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.fact:last-child { border-bottom: 0; }
.fi { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.fi .i { width: 15px; height: 15px; }
.fact small { display: block; font-size: 11px; color: var(--ink-3); }
.fact b { display: block; font-weight: 500; font-size: 13px; }

/* ============ Páginas (relatórios, equipe, conexão, agente) ============ */
.view { overflow-y: auto; padding: 24px clamp(14px, 3.5vw, 40px) 40px; }
.view-in { max-width: 1200px; margin: 0 auto; }
.view-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.view-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.view-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card, .card + .grid2, .grid2 + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head small { color: var(--ink-3); font-size: 12px; }
.pad { padding: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px; }
.toolbar .field-l { min-width: 140px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.kpi { padding: 14px 16px; }
.kpi small { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-weight: 500; font-size: 12px; }
.kpi small i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink)); }
.kpi b { display: block; margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--ink-3); font-size: 12px; }
.stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.stack i { background: var(--c); transition: width .4s; }
.stack i + i { border-left: 2px solid var(--surface); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { padding: 8px 16px; background: var(--surface-3); border-bottom: 1px solid var(--line); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); text-align: left; white-space: nowrap; }
.tbl td { padding: 9px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: middle; font-size: 13px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-3); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.bar { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.bar i { display: block; height: 5px; border-radius: 999px; background: var(--brand); }
.person { display: flex; align-items: center; gap: 10px; }
.person b { display: block; font-weight: 600; }
.person small { color: var(--ink-3); font-size: 12px; }
.empty-row { padding: 30px 16px !important; text-align: center; color: var(--ink-3); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status.on::before { background: #22c55e; }

/* Gaveta (novo/editar membro) */
.drawer { margin: 0 0 0 auto; width: min(440px, 100%); height: 100%; max-height: none; padding: 0; border: 0; background: var(--surface); color: var(--ink); box-shadow: -20px 0 50px rgba(0, 0, 0, .25); }
.drawer[open] { display: flex; flex-direction: column; animation: slide .22s ease-out; }
.drawer::backdrop { background: rgba(2, 6, 23, .45); backdrop-filter: blur(2px); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 16px; padding: 18px 16px; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.seg label, .seg button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-weight: 600; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.seg input { display: none; }
.seg label:has(input:checked), .seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.ufs { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 5px; }
.ufs label { cursor: pointer; }
.ufs input { display: none; }
.ufs span { display: grid; place-items: center; height: 30px; border-radius: 7px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); transition: .12s; }
.ufs input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.hint-box { padding: 10px 12px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--ink-2); font-size: 12.5px; }

/* Conexão */
.conn-status { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card > .conn-status:last-child { border-bottom: 0; }
.conn-icon { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.conn-icon.ok { background: var(--t-ap-bg); color: var(--t-ap-c); }
.conn-icon.wait { background: var(--t-pe-bg); color: var(--t-pe-c); }
.conn-icon.off { background: var(--t-ag-bg); color: var(--t-ag-c); }
.conn-status h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.conn-status p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.conn-status .pill { margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--t-ap-bg); color: var(--t-ap); }
.pill.wait { background: var(--t-pe-bg); color: var(--t-pe); }
.pill.off { background: var(--t-ag-bg); color: var(--t-ag); }
.conn-body { padding: 18px; }
.conn-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: center; margin-top: 18px; }
.steps-list { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; gap: 14px; }
.steps-list li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); line-height: 1.5; }
.steps-list li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12px; }
.steps-list b { color: var(--ink); }
.qr-box { display: grid; gap: 12px; justify-items: center; padding: 18px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-2); }
.qr-frame { width: 244px; height: 244px; display: grid; place-items: center; padding: 10px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.qr-frame img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-wait { display: grid; justify-items: center; gap: 8px; color: #64748b; font-size: 12.5px; text-align: center; }
.phone-in { display: flex; align-items: stretch; width: 100%; }
.phone-in span { display: grid; place-items: center; padding: 0 11px; border: 1px solid var(--line); border-right: 0; border-radius: 9px 0 0 9px; background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
.phone-in .input { border-radius: 0 9px 9px 0; font-size: 15px; letter-spacing: .02em; }
.qr-box .field-l { width: 100%; }
.otp { display: flex; align-items: center; gap: 4px; }
.otp span { width: 31px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font: 700 20px/1 ui-monospace, "SF Mono", Menlo, monospace; box-shadow: var(--shadow-sm); }
.otp em { width: 8px; height: 2px; background: var(--ink-3); }
.conn-ok { padding: 18px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.conn-ok p { margin: 0; color: var(--ink-2); max-width: 560px; }

/* Agente (página) */
.agent-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 20px; align-items: end; }
.agent-grid .full { grid-column: 1 / -1; }
.prompt { height: auto; padding: 10px 12px; line-height: 1.55; resize: vertical; font: 12.5px/1.55 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link { border: 0; background: none; padding: 0; color: var(--brand-ink); font-weight: 600; font-size: 12px; }
.link:hover { text-decoration: underline; }
.hint-box pre { margin: 8px 0; padding: 9px 11px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); }
.test-box { display: grid; gap: 12px; align-content: start; }
.test-result { display: grid; gap: 5px; justify-items: start; padding: 12px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--line-2); }
.test-result p { margin: 0; }
.test-result .spin { display: inline-block; vertical-align: middle; margin-right: 6px; }
.card-head .check { font-size: 12.5px; }

/* Login */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1100px 560px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent) 0, transparent 60%), radial-gradient(800px 480px at 110% 110%, color-mix(in srgb, var(--ai-2) 14%, transparent) 0, transparent 55%), var(--bg); }
.auth-card { width: 380px; max-width: 100%; padding: 30px 28px 28px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .14); display: grid; gap: 14px; }
.auth-card .logo { margin: 0 0 4px; width: 46px; height: 46px; border-radius: 14px; }
.auth-card h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.auth-card p { margin: -8px 0 4px; color: var(--ink-2); }

/* ============ Agente de IA nas conversas ============ */
.orb { position: relative; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ai-grad); box-shadow: 0 0 0 0 rgba(124, 58, 237, .45), 0 0 10px rgba(6, 182, 212, .7); animation: orb 2.4s ease-in-out infinite; }
@keyframes orb { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, .45), 0 0 8px rgba(6, 182, 212, .55); } 50% { box-shadow: 0 0 0 5px rgba(124, 58, 237, 0), 0 0 14px rgba(6, 182, 212, .9); } }
@keyframes shimmer { to { background-position: 200% center; } }
@keyframes spinGrad { to { --ang: 360deg; } }
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.agent-chip { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px 0 9px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; background: linear-gradient(var(--ai-ink), var(--ai-ink)) padding-box, conic-gradient(from var(--ang), var(--ai-1), var(--ai-2), var(--ai-3), var(--ai-1)) border-box; border: 1.5px solid transparent; box-shadow: 0 4px 14px rgba(124, 58, 237, .25); animation: spinGrad 6s linear infinite; }
.agent-chip:hover { box-shadow: 0 6px 20px rgba(6, 182, 212, .35); }
.agent-chip.busy { animation-duration: 1.5s; }
.agent-chip.busy .ag-label, .agent-card.busy .ag-verdict { background: linear-gradient(90deg, #fff 0%, #a5f3fc 30%, #fff 60%); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.4s linear infinite; }
.agent-chip.off { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); box-shadow: none; animation: none; }
.agent-chip.off .orb, .agent-card.off .orb { background: var(--ink-3); animation: none; box-shadow: none; }

.chip.ai { padding-right: 5px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ai-1) 35%, transparent); }
.chip.ai .i { width: 11px; height: 11px; color: var(--ai-soft-ink); }
.chip.ag-mini { gap: 5px; color: var(--ai-soft-ink); background: color-mix(in srgb, var(--ai-1) 12%, var(--surface)); }
.chip.ag-mini .orb { width: 6px; height: 6px; }

.ag-event { align-self: center; display: inline-flex; align-items: center; gap: 8px; max-width: min(92%, 540px); margin: 10px 0 4px; padding: 6px 11px 6px 7px; border-radius: 11px; font-size: 12px; color: #e2e8f0; line-height: 1.35; background: linear-gradient(var(--ai-ink), var(--ai-ink)) padding-box, var(--ai-grad) border-box; border: 1px solid transparent; box-shadow: 0 6px 18px rgba(13, 27, 42, .18), 0 0 18px rgba(6, 182, 212, .12); animation: fade .3s; }
.ag-event b { color: #fff; }
.ag-event time { flex: none; margin-left: 4px; font-size: 10.5px; color: #94a3b8; }
.ag-spark { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--ai-grad); color: #fff; }
.ag-spark .i { width: 12px; height: 12px; }
.ag-event.manual { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); box-shadow: var(--bubble-shadow); }
.ag-event.manual b { color: var(--ink); }
.ag-event.manual .ag-spark { background: var(--surface-2); color: var(--ink-2); }

.ag-reading { left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #e0f2fe; background: rgba(13, 27, 42, .92); backdrop-filter: blur(6px); box-shadow: 0 8px 24px rgba(13, 27, 42, .25), 0 0 0 1px rgba(6, 182, 212, .35); animation: fade .25s; white-space: nowrap; }
.ag-reading i { width: 4px; height: 4px; border-radius: 50%; background: #67e8f9; animation: dots 1.2s infinite; }
.ag-reading i:nth-of-type(2) { animation-delay: .15s; }
.ag-reading i:nth-of-type(3) { animation-delay: .3s; margin-left: -4px; }
.ag-reading i:first-of-type { margin-left: -2px; }
@keyframes dots { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.agent-card { position: relative; margin: 12px 12px 2px; padding: 14px; border-radius: 14px; overflow: hidden; color: #e2e8f0; background: radial-gradient(120% 90% at 100% 0%, rgba(124, 58, 237, .35) 0, transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(6, 182, 212, .28) 0, transparent 60%), var(--ai-ink); box-shadow: 0 12px 30px rgba(13, 27, 42, .22); }
.agent-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: conic-gradient(from var(--ang), rgba(124, 58, 237, .9), rgba(6, 182, 212, .9), rgba(34, 197, 94, .7), rgba(124, 58, 237, .9)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: spinGrad 8s linear infinite; pointer-events: none; }
.agent-card.busy::before { animation-duration: 1.6s; }
.agent-card.off { background: var(--surface-3); color: var(--ink-2); box-shadow: none; }
.agent-card.off::before { background: var(--line); animation: none; }
.agent-card.off .ag-verdict { color: var(--ink); }
.ag-head { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.ag-head b { font-weight: 700; white-space: nowrap; }
.ag-model { margin-left: auto; min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 10px; letter-spacing: .02em; text-transform: none; color: #a5f3fc; }
.agent-card.off .ag-model { background: var(--surface-2); color: var(--ink-3); }
.ag-verdict { margin: 10px 0 3px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.ag-line { display: flex; align-items: center; gap: 7px; margin: 5px 0; font-weight: 500; color: #f1f5f9; }
.agent-card.off .ag-line { color: var(--ink); }
.ag-line .i { width: 15px; height: 15px; color: #67e8f9; }
.ag-meta { margin: 5px 0 0; font-size: 11.5px; color: #94a3b8; }
.agent-card.off .ag-meta { color: var(--ink-3); }
.ag-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; height: 31px; padding: 0 12px; border: 0; border-radius: 9px; font-size: 12px; font-weight: 600; color: #fff; background: var(--ai-grad); background-size: 150% auto; box-shadow: 0 6px 16px rgba(124, 58, 237, .35); transition: background-position .4s, transform .1s; }
.ag-btn:hover { background-position: right center; }
.ag-btn:active { transform: scale(.97); }
.ag-btn:disabled { opacity: .5; pointer-events: none; }
.ag-btn .i { width: 14px; height: 14px; }

/* Etapa manual (painel do contato) */
.stage-pick { padding: 12px 16px 14px; border-bottom: 1px solid var(--line-2); }
.stage-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.stage-opts button { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px; height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: .15s; }
.stage-opts button:hover { background: var(--hover); }
.stage-opts button .i { width: 13px; height: 13px; }
.stage-opts button.on { border-color: var(--c, var(--ai-1)); color: var(--ink); background: color-mix(in srgb, var(--c, var(--ai-1)) 10%, var(--surface)); box-shadow: 0 0 0 1px var(--c, var(--ai-1)) inset; }
.stage-opts button[data-stage="auto"] { --c: var(--ai-1); }
.stage-opts button[data-stage="auto"].on .i { color: var(--ai-soft-ink); }
.stage-cafe { display: flex; gap: 6px; margin-top: 8px; }
.stage-cafe .input { height: 32px; font-size: 12.5px; }
.stage-cafe .btn { height: 32px; padding: 0 10px; font-size: 12px; }
.stage-note { margin: 7px 0 0; font-size: 11.5px; color: var(--ink-3); }

/* ============ Responsivo ============ */
@media (max-width: 1279px) {
    .inbox { grid-template-columns: 60px 330px minmax(0, 1fr); }
    #info { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; box-shadow: -20px 0 50px rgba(0, 0, 0, .2); }
}

@media (max-width: 860px) {
    .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
    .rail { grid-row: 2; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); gap: 0; border-top: 1px solid rgba(255, 255, 255, .06); }
    .logo, .me { display: none; }
    .rail-items, .rail-foot { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
    .rail-foot { flex: 0 0 auto; }
    .rail-items a, .rail-foot a, .rail-foot button { width: auto; min-width: 48px; height: 48px; padding: 0 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
    .rail-items a span, .rail-foot a span, .rail-foot button span { display: block; font-size: 10px; font-weight: 600; }
    .rail-items a.on { background: none; }
    .rail [data-label]:hover::after { display: none; }
    .rail .dot { top: 5px; right: calc(50% - 15px); }
    .inbox { grid-template-columns: minmax(0, 1fr); }
    .inbox #chat { display: none; }
    .inbox.in-chat { grid-template-rows: minmax(0, 1fr); }
    .inbox.in-chat .rail, .inbox.in-chat #list { display: none; }
    .inbox.in-chat #chat { display: flex; }
    #back { display: grid; }
    #info { width: 100%; }
    #msgs { padding: 10px; }
    .msg { max-width: 86%; }
    .chat-head { padding: 0 6px; }
    #head-tag { display: none; }
    .agent-chip .ag-label { display: none; }
    .agent-chip { padding: 0 9px; }
    .ag-reading { bottom: 70px; }
    .view { padding: 18px 14px 28px; }
    .view-head h1 { font-size: 20px; }
    .conn-grid, .agent-grid { grid-template-columns: 1fr; gap: 18px; }
    .conn-status { flex-wrap: wrap; padding: 14px; }
    .conn-status .pill { margin-left: 0; }
    .conn-body { padding: 14px; }
    .qr-frame { width: 224px; height: 224px; }
}
.theme-btn i { display: block; font-style: normal; }
.theme-btn .sun { display: none; }
@media (max-width: 860px) { .rail-foot .theme-btn { flex-direction: column; } }

/* ============ CRM · jornada, equipe e colaboração ============ */
:root {
    --crm-wash: color-mix(in srgb, var(--brand) 5%, var(--bg));
    --crm-card-shadow: 0 2px 5px color-mix(in srgb, var(--ink) 3%, transparent), 0 9px 20px color-mix(in srgb, var(--ink) 3%, transparent);
    --crm-hover-shadow: 0 7px 22px color-mix(in srgb, var(--ink) 9%, transparent);
}
.eyebrow { display: block; color: var(--ink-2); font-size: 9px; font-weight: 750; letter-spacing: .14em; line-height: 1.6; }
.workspace-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.workspace-brand { display: inline-flex; align-items: center; gap: 7px; font-size: 20px; font-weight: 750; letter-spacing: -.06em; color: var(--ink); }
.workspace-brand > i { width: 10px; height: 10px; background: var(--brand); border-radius: 3px; box-shadow: 0 0 0 4px var(--brand-soft); margin-right: 3px; }
.workspace-brand > span { font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); margin-left: 9px; }
.workspace-tabs { display: flex; gap: 4px; align-items: center; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.workspace-tabs a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 13px; color: var(--ink-2); border-radius: 8px; font-size: 12px; font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; }
.workspace-tabs a:hover { background: var(--hover); color: var(--ink); }
.workspace-tabs a.on { color: var(--brand-ink); background: var(--brand-soft); box-shadow: var(--shadow-sm); font-weight: 650; }
.product-heading { margin-bottom: 22px; }
.product-heading .eyebrow { margin-bottom: 8px; }
.product-heading h1 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.12; letter-spacing: -.045em; font-weight: 750; }
.product-heading h1 > span { color: var(--brand-ink); }
.product-heading p { margin-top: 9px; font-size: 12.5px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-view { min-width: 0; width: 100%; overflow: auto; background: radial-gradient(ellipse at top right, var(--crm-wash), transparent 50%), var(--bg); padding-top: 20px; }
.crm-overview { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 12px; margin: 0 0 26px; }
.crm-overview article { position: relative; display: flex; align-items: center; gap: 12px; min-height: 82px; padding: 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 13px; box-shadow: var(--shadow-sm); overflow: hidden; }
.crm-overview small { display: block; font-size: 11px; color: var(--ink-2); }
.crm-overview b { display: block; margin-top: 3px; font-size: 25px; line-height: 1; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-icon { display: grid; place-items: center; width: 37px; height: 37px; flex: none; border-radius: 11px; background: var(--brand-soft); color: var(--brand-ink); }
.metric-icon.amber { color: var(--t-pe); background: var(--t-pe-bg); }
.metric-icon.blue { color: var(--t-ca); background: var(--t-ca-bg); }
.metric-icon.green { color: var(--t-ap); background: var(--t-ap-bg); }
.crm-overview .overview-feature { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 18%, var(--line)); padding-bottom: 24px; }
.overview-feature .metric-icon { background: var(--surface); }
.overview-feature b { color: var(--brand-ink); }
.metric-context { position: absolute; bottom: 7px; left: 65px; font-size: 9px; color: var(--brand-ink); opacity: .8; }
.board-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.board-section-head h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.025em; }
.board-section-head .muted { font-size: 11px; }
.board-live { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--ink-2); padding: 6px 9px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; white-space: nowrap; }
.board-live i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.board-live i.waiting { background: var(--t-pe); }
.crm-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 12px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.crm-filters label { display: grid; gap: 5px; color: var(--ink-3); font-size: 10px; font-weight: 600; }
.crm-filters .board-search { flex: 1; min-width: 160px; }
.crm-filters .board-search .input { width: 100%; }
.crm-filters .input { width: 140px; height: 32px; background: var(--surface-3); font-size: 11px; }
.crm-filters .btn { height: 32px; font-size: 11px; }
#board-status { margin-left: auto; align-self: center; font-size: 10px; max-width: 280px; line-height: 1.5; }
.crm-board { display: flex; align-items: stretch; gap: 13px; overflow-x: auto; padding: 0 2px 18px; scroll-snap-type: x proximity; }
.crm-column { flex: 0 0 264px; min-width: 0; display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; min-height: 330px; max-height: max(380px, calc(100dvh - 400px)); scroll-snap-align: start; transition: background .18s, border-color .18s, box-shadow .18s; }
.crm-column > header { padding: 14px 12px 12px; flex: none; }
.crm-column > header > div { display: flex; align-items: center; gap: 7px; }
.crm-column > header i { width: 7px; height: 7px; border-radius: 50%; background: var(--stage-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage-color) 10%, transparent); }
.crm-column h3 { margin: 0; font-size: 12px; font-weight: 650; }
.column-count { margin-left: auto; font-size: 10px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.crm-column > header small { display: block; margin: 7px 0 10px 14px; font-size: 10px; color: var(--ink-3); }
.column-progress { position: relative; display: block; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.column-progress::before { content: ''; display: block; width: var(--progress); height: 100%; min-width: 4px; background: var(--stage-color); border-radius: inherit; opacity: .8; }
.crm-cards { padding: 0 8px 8px; flex: 1; min-height: 0; overflow-y: auto; }
.crm-card { padding: 12px; margin-bottom: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--crm-card-shadow); cursor: grab; transition: transform .16s, box-shadow .16s, border-color .16s; }
.crm-card:hover { transform: translateY(-2px); box-shadow: var(--crm-hover-shadow); border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.crm-card.dragging { opacity: .45; transform: rotate(-1deg); }
.crm-column.drop-target { background: var(--brand-soft); border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.card-source { display: inline-block; font-size: 9px; line-height: 1.4; font-weight: 550; padding: 3px 6px; border-radius: 5px; color: var(--ink-2); background: var(--surface-2); max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-grip { color: var(--ink-3); font-size: 17px; line-height: 1; }
.crm-avatar { width: 33px; height: 33px; flex: none; display: inline-grid; place-items: center; border-radius: 11px; font-size: 10px; font-weight: 650; background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 50% var(--av-ink-l)); }
.crm-avatar.tiny { width: 20px; height: 20px; border-radius: 50%; font-size: 7px; }
.crm-avatar.large { width: 60px; height: 60px; border-radius: 20px; font-size: 20px; }
.crm-card-identity { width: 100%; display: flex; align-items: center; gap: 9px; padding: 0; border: 0; background: none; text-align: left; color: var(--ink); cursor: pointer; }
.crm-card-identity > span:nth-child(2) { flex: 1; min-width: 0; }
.crm-card-identity strong { display: block; font-size: 12px; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
.crm-card-identity small { display: block; margin-top: 3px; color: var(--ink-3); font-size: 10px; overflow-wrap: anywhere; }
.card-arrow { color: var(--ink-3); font-size: 13px; }
.card-donation { display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-top: 12px; padding: 7px 8px; border-radius: 7px; background: var(--t-ap-bg); color: var(--t-ap); }
.card-donation span { font-size: 9px; }
.card-donation b { font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card-loss { padding: 7px 8px; margin: 9px 0 0; border-radius: 7px; color: var(--t-ag); background: var(--t-ag-bg); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.crm-card > footer { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.card-owner { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--ink-2); font-size: 9px; }
.card-owner > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 108px; }
.crm-card > footer time { font-size: 8px; color: var(--ink-3); white-space: nowrap; }
.crm-card .card-stage-select { margin-top: 10px; height: 27px; padding: 0 7px; border-color: var(--line-2); background: var(--surface-3); color: var(--ink-2); font-size: 10px; cursor: pointer; }
.column-empty { display: grid; place-items: center; padding: 24px 10px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3); }
.column-empty > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px dashed var(--line); font-size: 16px; }
.column-empty p { margin: 9px 0 6px; font-size: 11px; line-height: 1.6; }
.column-empty small { font-size: 9px; }
.column-limit { padding: 9px; text-align: center; font-size: 9px; color: var(--ink-3); }
.board-loading { display: flex; gap: 12px; align-items: center; min-height: 200px; padding: 20px; font-size: 13px; color: var(--ink-2); }
.crm-empty-state { display: grid; place-items: center; min-height: 200px; padding: 30px; grid-column: 1/-1; text-align: center; color: var(--ink-2); border: 1px dashed var(--line); border-radius: 14px; width: 100%; }
.crm-empty-state > span { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: var(--brand); background: var(--brand-soft); }
.crm-empty-state h2 { margin: 12px 0 0; font-size: 17px; letter-spacing: -.02em; color: var(--ink); }
.crm-empty-state p { font-size: 12px; }

/* Gavetas e edição visual */
.crm-dialog { width: min(650px,94vw); max-height: 85dvh; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.crm-dialog::backdrop { background: color-mix(in srgb, var(--ink) 35%, transparent); backdrop-filter: blur(4px); }
.crm-dialog h2 { font-size: 20px; letter-spacing: -.03em; margin: 6px 0 12px; }
.crm-dialog .muted { font-size: 12px; line-height: 1.7; }
.crm-dialog form > .field-l { margin-top: 18px; }
.crm-dialog footer { display: flex; justify-content: end; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.dialog-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; margin-bottom: 12px; }
.crm-stage-row { display: grid; grid-template-columns: 8px 1fr 120px 66px; align-items: center; gap: 8px; padding: 8px; margin: 7px 0; border: 1px solid var(--line-2); background: var(--surface-3); border-radius: 10px; }
.crm-stage-row .input { width: 100%; min-width: 0; height: 34px; font-size: 12px; }
.stage-swatch { display: block; width: 6px; height: 24px; border-radius: 6px; background: var(--stage-color); }
#stage-add { margin-top: 8px; }
.contact-sheet-hero { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 12px 0 20px; }
.contact-sheet-hero .eyebrow { margin-top: 6px; }
.contact-sheet-hero h2 { margin: 0; font-size: 23px; }
.contact-sheet-hero p { font-size: 12px; color: var(--ink-2); margin: 0 0 6px; overflow-wrap: anywhere; }
.contact-sheet-assignment { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); }
.crm-timeline { padding: 20px 18px; border-top: 1px solid var(--line-2); }
#contact-detail .crm-timeline { padding: 22px 0 0; margin-top: 18px; }
.crm-event { position: relative; display: flex; gap: 11px; padding: 10px 0; font-size: 11px; }
.crm-event::before { content: ''; position: absolute; left: 13px; top: 37px; bottom: -9px; width: 1px; background: var(--line); }
.crm-event:last-child::before { display: none; }
.crm-event > span { display: grid; place-items: center; flex: none; width: 27px; height: 27px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; }
.crm-event > div { min-width: 0; }
.crm-event b { color: var(--ink); font-size: 11px; font-weight: 600; }
.crm-event p { margin: 4px 0; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.crm-event small { display: block; margin-top: 4px; color: var(--ink-3); font-size: 10px; }

/* Inbox: filtros explícitos, sem estados escondidos */
.pane-head { padding: 17px 17px 13px; }
.pane-head h1 { display: flex; align-items: center; gap: 7px; font-size: 21px; letter-spacing: -.04em; }
.pane-head .eyebrow { margin-bottom: 4px; font-size: 8px; }
.inbox-brand-dot { display: inline-block; height: 6px; width: 6px; background: var(--brand); border-radius: 50%; }
.inbox-total { border: 1px solid var(--line); border-radius: 7px; padding: 4px 7px; font-size: 10px; color: var(--ink-3); }
.owner-tabs { display: flex; gap: 3px; margin: 0 12px 12px; padding: 4px; border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 10px; }
.owner-tabs label { flex: 1; position: relative; min-width: 0; cursor: pointer; }
.owner-tabs input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.owner-tabs label > span { display: flex; justify-content: center; align-items: center; gap: 5px; height: 30px; border-radius: 7px; font-size: 11px; font-weight: 550; color: var(--ink-2); transition: background .15s, box-shadow .15s; }
.owner-tabs b { font-size: 9px; opacity: .7; font-weight: 500; font-variant-numeric: tabular-nums; }
.owner-tabs input:checked + span { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.owner-tabs input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.row { margin: 2px 7px; padding: 10px 8px; }
.row.on { box-shadow: inset 3px 0 var(--brand); }
.row .line3 { flex-wrap: wrap; }
.row .line3 > .chip:last-child { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.crm-owner-control { padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-3); }
.crm-owner-control .input { width: 100%; margin: 6px 0; font-size: 12px; }
.crm-owner-control small { font-size: 10px; }
.hero { background: linear-gradient(180deg, var(--crm-wash), var(--surface)); }
.hero .avatar { border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }

/* Escrever uma mensagem ≠ registrar uma nota */
.compose-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px 0; background: var(--composer); z-index: 3; }
.compose-modes { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 3px; border: 1px solid var(--line); }
.compose-modes button { display: flex; align-items: center; gap: 5px; background: none; border: 0; border-radius: 6px; padding: 6px 9px; color: var(--ink-2); font-size: 10px; font-weight: 550; cursor: pointer; }
.compose-modes button.on { color: var(--brand-ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.compose-tools.note-mode { background: var(--t-pe-bg); }
.compose-tools.note-mode .compose-modes button.on { color: var(--t-pe); }
#mode-status { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--t-pe); }
.quick-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 5px 0; border: 0; background: none; color: var(--ink-2); font-size: 10px; }
.quick-toggle:hover { color: var(--brand-ink); }
kbd { display: inline-grid; place-items: center; padding: 2px 5px; min-width: 18px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--ink-2); font-size: 10px; font-family: inherit; }
.composer.note-mode { background: var(--t-pe-bg); border-top: 0; }
.composer.note-mode .field { border: 1px solid color-mix(in srgb, var(--t-pe) 22%, var(--line)); border-radius: 12px; }
.composer.note-mode .send { background: var(--t-pe); color: var(--surface); border-radius: 12px; box-shadow: none; }
.internal-note { align-self: center; width: min(85%,560px); margin: 13px 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--t-pe) 20%, var(--line)); border-radius: 11px; background: var(--t-pe-bg); color: var(--ink); box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.internal-note header { display: flex; align-items: center; gap: 6px; color: var(--t-pe); }
.internal-note header .i { width: 13px; height: 13px; }
.internal-note header b { font-size: 11px; }
.internal-note header span { margin-left: auto; font-size: 9px; opacity: .8; }
.internal-note p { white-space: pre-wrap; margin: 10px 0; font-size: 12px; line-height: 1.6; }
.internal-note footer { display: flex; justify-content: space-between; gap: 8px; font-size: 9px; color: var(--t-pe); }
.quick-menu { position: absolute !important; left: 14px; right: 14px; bottom: 103px; max-height: min(370px,55dvh); overflow-y: auto; z-index: 8; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.quick-menu > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.quick-menu > header small { font-size: 9px; font-weight: 400; color: var(--ink-3); }
.quick-menu > button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: none; color: var(--ink); text-align: left; }
.quick-menu > button:hover, .quick-menu > button[aria-selected="true"] { background: var(--brand-soft); }
.quick-menu b { font-size: 11px; font-weight: 600; }
.quick-menu button small { display: block; margin-top: 4px; font-size: 10px; color: var(--ink-2); max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-menu > p { font-size: 12px; color: var(--ink-2); padding: 12px 14px; }
.quick-menu a { color: var(--brand-ink); font-weight: 600; }

/* Biblioteca de respostas rápidas */
.reply-guide { display: flex; align-items: center; gap: 13px; padding: 17px 20px; border: 1px solid var(--line); background: var(--surface); border-radius: 13px; margin: 20px 0; }
.reply-guide-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; color: var(--ai-soft-ink); background: color-mix(in srgb, var(--ai-1) 10%, var(--surface)); border-radius: 12px; }
.reply-guide b { font-size: 12px; font-weight: 650; }
.reply-guide p { font-size: 11px; line-height: 1.7; margin: 5px 0 0; color: var(--ink-2); }
.reply-guide code { padding: 2px 5px; border-radius: 4px; background: var(--surface-2); font-size: 10px; }
.reply-library { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 15px; }
.reply-card { display: flex; flex-direction: column; padding: 18px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--crm-card-shadow); cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; }
.reply-card:hover { transform: translateY(-3px); box-shadow: var(--crm-hover-shadow); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.reply-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reply-shortcut { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 10px; font-weight: 550; background: var(--surface-3); }
.reply-state { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; color: var(--brand-ink); }
.reply-state::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.reply-card.inactive .reply-state { color: var(--ink-3); }
.reply-card h2 { margin: 18px 0 9px; font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.reply-card > p { flex: 1; margin: 0 0 18px; color: var(--ink-2); font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-card footer { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line-2); color: var(--brand-ink); font-size: 10px; font-weight: 600; }
.shortcut-input { position: relative; display: flex; align-items: center; }
.shortcut-input > span { position: absolute; left: 13px; font-size: 15px; color: var(--ink-3); }
.shortcut-input .input { padding-left: 25px; }
.input.reply-textarea { height: auto; min-height: 100px; padding: 12px; resize: vertical; font-size: 13px; line-height: 1.7; }
.variable-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 18px; }
.variable-chips button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-3); font-size: 10px; font-weight: 500; color: var(--brand-ink); }
.reply-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
:where(.crm-card-identity,.reply-card,.compose-modes button,.quick-toggle,.quick-menu button,.workspace-tabs a):focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
@media (max-width: 1100px) {
    .crm-overview { gap: 8px; }
    .crm-overview article { padding: 12px; gap: 8px; }
    .crm-overview .overview-feature { padding-bottom: 23px; }
    .metric-context { left: 56px; font-size: 8px; }
    .metric-icon { width: 32px; height: 32px; }
    #board-status { margin-left: 0; }
}
@media (max-width: 860px) {
    .crm-view { width: 100%; padding-top: 16px; }
    .workspace-top { margin-bottom: 20px; }
    .workspace-brand { font-size: 18px; }
    .workspace-tabs { gap: 2px; }
    .workspace-tabs a { padding: 6px 10px; font-size: 10px; }
    .product-heading h1 { font-size: 29px; }
    .heading-actions { width: 100%; }
    .heading-actions .btn { font-size: 11px; height: 34px; }
    .crm-overview { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
    .crm-overview article { min-height: 76px; }
    .crm-overview small { font-size: 9px; }
    .crm-overview b { font-size: 23px; }
    .metric-context { font-size: 7px; left: 12px; }
    .crm-filters { gap: 8px; }
    .crm-filters label { flex: 1 0 calc(50% - 8px); min-width: 0; }
    .crm-filters .input { width: 100%; }
    #board-status { flex: 1 0 100%; max-width: none; font-size: 9px; }
    .crm-column { flex-basis: min(280px,83vw); max-height: 65dvh; min-height: 300px; }
    .board-section-head .muted { font-size: 10px; }
    .board-live { font-size: 9px; }
    .crm-dialog { padding: 18px; border-radius: 14px; }
    .crm-stage-row { grid-template-columns: 6px 1fr 83px 54px; gap: 5px; padding: 6px; }
    .crm-stage-row .input { padding-left: 7px; font-size: 10px; }
    .contact-sheet-assignment { grid-template-columns: 1fr; }
    .compose-tools { gap: 6px; padding-left: 10px; padding-right: 10px; }
    .compose-modes button { font-size: 9px; padding: 6px 7px; }
    .quick-toggle { font-size: 9px; }
    #mode-status { font-size: 9px; }
    .internal-note { width: 92%; }
    .internal-note header span { font-size: 8px; }
    .quick-menu { left: 8px; right: 8px; }
    .quick-menu button small { max-width: 180px; }
    .reply-guide { padding: 14px; align-items: start; }
    .reply-library { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .crm-card,.reply-card,.crm-column,.workspace-tabs a,.owner-tabs label > span { transition: none; }
    .crm-card:hover,.reply-card:hover { transform: none; }
}
@media (max-width: 860px) {
    .rail { min-width: 0; }
    .rail-items { min-width: 0; justify-content: flex-start; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--rail-ink) var(--rail); overscroll-behavior-x: contain; }
    .rail-items a { flex: 1 0 62px; min-width: 62px; max-width: 100px; }
    .rail-items a span { text-align: center; line-height: 1.15; }
    .rail-foot a,.rail-foot button { min-width: 40px; }
    .rail-foot a span,.rail-foot button span { font-size: 9px; }
}

/* Inbox compacta: marca e conversas compartilham um único acesso. */
.rail-items .brand-home, .rail-items .brand-home.on { background: linear-gradient(135deg, var(--t-ap-c), var(--brand)); color: var(--on-brand); margin-bottom: 12px; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.inbox .pane-head { padding: 12px 14px 10px; }
.inbox .pane-head h1 { font-size: 19px; }
.inbox .search { height: 33px; margin-bottom: 8px; }
.inbox .owner-tabs { margin-bottom: 6px; padding: 3px; }
.inbox .owner-tabs label > span { height: 27px; }
.status-filter { display: flex; align-items: center; gap: 8px; padding: 0 14px 8px; border-bottom: 1px solid var(--line); }
.status-filter label { font-size: 10px; color: var(--ink-3); }
.status-filter select { flex: 1; min-width: 0; height: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 11px; cursor: pointer; }
.status-filter select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 860px) {
    .rail-items .brand-home, .rail-items .brand-home.on { margin-bottom: 0; }
}

.monitor-filters { display: grid; grid-template-columns: minmax(0,1fr) 110px; gap: 6px; padding: 0 12px 7px; }
.monitor-filters .input { min-width: 0; height: 31px; font-size: 11px; background: var(--surface-2); }

.contact-notes { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.contact-notes > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.contact-notes > header b { font-size: 12px; }
.contact-notes > header small { font-size: 9px; color: var(--t-pe); }
.contact-notes textarea { height: auto; min-height: 74px; padding: 9px; resize: vertical; font-size: 12px; line-height: 1.5; }
.contact-notes > .btn { margin-top: 7px; height: 30px; font-size: 11px; }
.contact-note-history { max-height: 280px; overflow-y: auto; margin-top: 12px; }
.contact-note-history article { border: 1px solid var(--line); border-radius: 8px; background: var(--t-pe-bg); padding: 9px; margin-bottom: 8px; }
.contact-note-history p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 0 0 8px; }
.contact-note-history footer { display: flex; gap: 6px; justify-content: space-between; font-size: 9px; color: var(--ink-2); }

.flow-view .view-in { max-width: 1320px; }
.flow-toolbar {
    display: grid;
    grid-template-columns: minmax(160px, 1.5fr) repeat(2, minmax(130px, 1fr)) auto;
    align-items: end;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.flow-toolbar > *, .flow-toolbar .input, .flow-details .input { min-width: 0; }
.flow-feedback { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; margin: 10px 0 14px; color: var(--ink-2); }
.flow-feedback small:last-child { color: var(--t-pe); }
.flow-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 280px); gap: 14px; align-items: start; }
.flow-canvas, .flow-details {
    min-width: 0;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}
.flow-canvas { background: var(--surface-3); }
.flow-details { display: grid; gap: 14px; background: var(--surface); }
.flow-details h2, .flow-simulation h2 { font-size: 16px; margin: 0; }
.flow-path { min-width: 0; display: grid; justify-items: center; }
.flow-card {
    display: grid;
    gap: 4px;
    width: min(100%, 390px);
    min-width: 0;
    padding: 11px 14px;
    text-align: left;
    overflow-wrap: anywhere;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--t-ap-c);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.flow-card[data-type="trigger"] { border-inline-start-color: var(--brand); }
.flow-card[data-type="condition"] { border-inline-start-color: var(--t-ca-c); }
.flow-card[data-type="wait"] { border-inline-start-color: var(--t-pe-c); }
.flow-card:hover { background: var(--hover); }
.flow-card[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--brand-ink); border-color: var(--brand-ink); }
.flow-card[data-visited] { background: var(--brand-soft); }
.flow-card[aria-invalid="true"] { border-color: var(--t-ag); }
.flow-kind { color: var(--ink-2); font-size: 11px; font-weight: 600; }
.flow-summary { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.flow-visited, .flow-invalid { color: var(--t-ap); font-size: 11px; font-weight: 650; }
.flow-invalid { color: var(--t-ag); }
.flow-add { position: relative; display: grid; justify-items: center; text-align: center; padding-block: 7px; max-width: 100%; }
.flow-add::before, .flow-add::after {
    content: "";
    position: absolute;
    width: 1px;
    height: 7px;
    inset-inline-start: 50%;
    background: var(--ink-3);
}
.flow-add::before { top: 0; }
.flow-add::after { bottom: 0; }
.flow-add:last-child::after { display: none; }
.flow-add summary {
    width: fit-content;
    margin-inline: auto;
    cursor: pointer;
    list-style: none;
    padding: 4px 9px;
    border-radius: 7px;
    color: var(--brand-ink);
    background: var(--brand-soft);
    font-size: 11px;
    font-weight: 650;
}
.flow-add-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding-top: 6px; }
.flow-add-options .btn { padding: 4px 7px; font-size: 11px; }
.flow-branches {
    position: relative;
    width: 100%;
    padding-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.flow-branches::before {
    content: "";
    position: absolute;
    inset: 0 25% auto;
    height: 10px;
    border-bottom: 1px solid var(--ink-3);
    background: linear-gradient(var(--ink-3), var(--ink-3)) center / 1px 100% no-repeat;
}
.flow-branch {
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    position: relative;
    container-type: inline-size;
}
.flow-branch::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    width: 1px;
    height: 8px;
    background: var(--ink-3);
}
.flow-branch-label { margin: 0; text-align: center; color: var(--t-ap); font-size: 12px; }
.flow-branch[data-branch="else"] > .flow-branch-label { color: var(--t-pe); }
.flow-branch .muted { text-align: center; }
.flow-view :focus-visible, .flow-simulation :focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.flow-view .flow-primary, .flow-simulation .flow-primary { background: var(--brand-soft); color: var(--ink); border: 1px solid var(--brand-ink); }
.flow-remove { justify-self: start; color: var(--t-ag); white-space: normal; }
.flow-trace { margin: 0; padding-inline-start: 22px; }
.flow-trace li { margin-bottom: 8px; overflow-wrap: anywhere; }
.flow-trace li span { display: block; font-size: 12px; color: var(--ink-2); white-space: pre-wrap; }
.flow-simulation #flow-scenario { display: grid; gap: 12px; margin: 14px 0; }
@container (max-width: 265px) {
    .flow-branches { grid-template-columns: minmax(0, 1fr); border-inline-start: 1px solid var(--ink-3); padding: 8px 0 0 8px; }
    .flow-branches::before, .flow-branch::before { display: none; }
}
@media (max-width: 850px) {
    .flow-workspace { grid-template-columns: minmax(0, 1fr); }
    .flow-details { grid-row: 1; }
}
@media (max-width: 600px) {
    .flow-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .flow-toolbar > :first-child { grid-column: 1 / -1; }
    .flow-toolbar .btn { justify-self: start; }
    .flow-canvas { padding: 8px; }
    .flow-card { padding: 8px; }
    .flow-branches { gap: 5px; }
    .flow-branch { padding: 5px; }
}
.flow-runtime { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.flow-runtime [hidden] { display: none; }
.flow-runtime .btn { padding: 5px 9px; font-size: 12px; }
.flow-history #flow-history-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.flow-history-run { padding: 8px 0; border-bottom: 1px solid var(--line); }
.flow-history-run summary { cursor: pointer; overflow-wrap: anywhere; }
.flow-history-run .flow-trace { margin: 8px 0; }

.inbox-brief { flex: none; padding: 7px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.inbox-brief summary { cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 650; }
.inbox-brief p { margin: 5px 0 0; color: var(--ink-2); font-size: 13px; max-height: 5.5em; overflow: auto; overflow-wrap: anywhere; }
.audio-transcript { display: grid; gap: 4px; margin-top: 6px; color: var(--ink-2); font-size: 12px; }
.audio-transcript p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.audio-transcript button { justify-self: start; }
.chip.inbox-urgent { color: var(--t-ag); background: var(--t-ag-bg); }
.inbox-brief-signals { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

#inbox-suggest { flex: none; color: var(--brand-ink); }
#inbox-suggest:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: -2px; }

/* ============ Fase 4: métricas ============ */
.seg-a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); text-decoration: none; }
.seg-a:hover { color: var(--ink); }
.seg-a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.metrics .kpi b { font-size: 22px; }
.metrics-hint { margin: 12px 2px 0; font-size: 12px; }
.tbl tr.me-row td { background: var(--brand-soft); }
.cost-list { display: grid; gap: 6px; }
.cost-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.cost-row b { display: block; font-variant-numeric: tabular-nums; }
.cost-row small { color: var(--ink-3); font-size: 12px; }

/* ============ Fase 4: agenda do café ============ */
.flip { display: inline-flex; transform: scaleX(-1); }
.agenda-nav { align-items: center; }
.agenda-nav .btn { gap: 4px; }
.agenda-title { font-size: 15px; margin-inline-end: auto; }
.agenda-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.agenda-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.agenda-week .card + .card { margin-top: 0; }
.agenda-day { display: flex; flex-direction: column; gap: 6px; padding: 8px; min-height: 160px; }
.agenda-day header { display: flex; align-items: baseline; gap: 6px; padding: 2px 4px 6px; border-bottom: 1px solid var(--line-2); }
.agenda-day header span { color: var(--ink-3); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.agenda-day header b { font-size: 18px; }
.agenda-day header em { margin-inline-start: auto; font-style: normal; font-size: 11px; font-weight: 700; color: var(--brand-ink); }
.agenda-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.agenda-day p { margin: 6px 4px; font-size: 12px; }
.cafe-ev { display: grid; gap: 3px; padding: 8px 9px; border-radius: 9px; color: var(--ink); text-decoration: none; border-inline-start: 3px solid var(--c); background: var(--surface-3); }
.cafe-ev:hover { background: var(--hover); }
.cafe-ev:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 1px; }
.cafe-ev time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.cafe-ev b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.cafe-ev span { display: flex; align-items: flex-start; gap: 4px; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.cafe-ev span .i { flex: none; margin-top: 2px; }
.cafe-ev em { justify-self: start; margin-top: 2px; }
.agenda-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-top: 14px; overflow: hidden; }
.agenda-wd { padding: 8px; background: var(--surface-3); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--ink-3); }
.agenda-cell { display: flex; flex-direction: column; gap: 4px; min-height: 104px; padding: 6px; border-bottom: 1px solid var(--line-2); border-inline-end: 1px solid var(--line-2); min-width: 0; }
.agenda-cell:nth-child(7n) { border-inline-end: 0; }
.agenda-cell.out { background: var(--surface-3); }
.agenda-cell.out .agenda-date { color: var(--ink-3); }
.agenda-cell.today .agenda-date { background: var(--brand); color: var(--on-brand); }
.agenda-date { align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink); text-decoration: none; }
.agenda-cell .cafe-ev { padding: 4px 6px; gap: 0; }
.agenda-cell .cafe-ev time { font-size: 11.5px; }
.agenda-cell .cafe-ev b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-more { font-size: 12px; color: var(--brand-ink); font-weight: 600; text-decoration: none; padding-inline-start: 4px; }
.agenda-undated { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; padding: 12px; }
@media (max-width: 1100px) {
    .agenda-week { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .agenda-day { min-height: 0; }
    .agenda-day.empty { opacity: .75; }
}
@media (max-width: 700px) {
    .agenda-week { grid-template-columns: minmax(0, 1fr); }
    .agenda-month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .agenda-cell { min-height: 64px; padding: 3px; }
    .agenda-cell .cafe-ev b { display: none; }
    .agenda-cell .cafe-ev { padding: 2px 3px; border-inline-start-width: 2px; }
    .agenda-wd { padding: 6px 2px; text-align: center; }
    .agenda-title { width: 100%; order: -1; }
}

/* ============ Fase 4: avisos e aplicativo ============ */
.rail-foot .push-bell.on { color: var(--gold); }
.push-invite { display: grid; gap: 8px; margin: 0 12px 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--brand); background: var(--brand-soft); color: var(--ink); font-size: 14px; line-height: 1.45; }
.push-invite[hidden] { display: none; }
.push-invite b { font-size: 15px; }
.push-invite span { color: var(--ink-2); }
.push-invite div { display: flex; flex-wrap: wrap; gap: 8px; }
.push-invite .btn { height: 42px; font-size: 14px; }
.view .push-invite { margin: 0 0 14px; }
.push-msg { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--t-pe-bg); color: var(--t-pe); font-size: 13.5px; }
.push-msg.ok { background: var(--t-ap-bg); color: var(--t-ap); }
.push-dialog { width: min(440px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.push-dialog::backdrop { background: rgba(2, 6, 23, .45); }
.push-box { display: grid; gap: 12px; padding: 18px; font-size: 14px; line-height: 1.45; }
.push-box header { display: flex; align-items: center; justify-content: space-between; }
.push-box h2 { margin: 0; font-size: 17px; }
.push-box p { margin: 0; }
.push-state { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
.push-state.on { background: var(--t-ap-bg); color: var(--t-ap); }
.push-actions { display: grid; gap: 8px; }
.push-actions .btn { height: 44px; font-size: 14px; justify-content: center; }
.capi-box p { margin: 0; line-height: 1.5; }
.capi-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px !important; }

/* ============ Fase 4: campanhas segmentadas ============ */
.segment-box { display: grid; gap: 12px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.segment-box legend { padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.segment-group { display: grid; gap: 6px; }
.segment-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.segment-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.segment-chips label { position: relative; }
.segment-chips input { display: block; position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segment-chips span { height: 28px; padding: 0 9px; white-space: nowrap; }
.segment-chips input:focus-visible + span { outline: 2px solid var(--brand-ink); outline-offset: 1px; }
.audience-wrap:empty { display: none; }
.audience { display: grid; gap: 10px; margin: 6px 0 14px; padding: 12px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); }
.audience h3 { margin: 0; font-size: 14px; }
.audience p { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.audience-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.audience-kpi { display: grid; gap: 1px; padding: 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); }
.audience-kpi b { font-size: 18px; font-variant-numeric: tabular-nums; }
.audience-kpi span { font-size: 11.5px; color: var(--ink-2); }
.audience-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 12.5px; }
.audience-lists ul { margin: 4px 0 0; padding-inline-start: 16px; }
.audience-delivery { padding: 8px 10px; border-radius: 8px; background: var(--t-pe-bg); color: var(--t-pe); font-weight: 600; }

/* ============ Canal duplo (Evolution + API oficial) ============ */
.head-channel { flex: none; }
.window-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 16px; background: var(--t-pe-bg); color: var(--t-pe); font-size: 13px; line-height: 1.4; border-top: 1px solid var(--line); }
.window-note[hidden] { display: none; }
.window-note .i { flex: none; margin-top: 1px; }
.channel-grid { display: grid; gap: 10px; padding: 16px; }
.channel-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 4px 12px; font-size: 13px; }
.channel-row dt { color: var(--ink-3); }
.channel-row dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .channel-row { grid-template-columns: minmax(0, 1fr); } .channel-row dd { margin-bottom: 6px; } }

/* ============ Integrações (chaves pelo painel) ============ */
.integ-form { display: grid; gap: 0; }
.integ-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 6px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); align-items: start; }
.integ-row > .field-l { padding-top: 8px; font-weight: 600; color: var(--ink); }
.integ-input { display: flex; gap: 6px; min-width: 0; }
.integ-input .input { flex: 1; min-width: 0; font-family: inherit; }
.integ-meta { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 12px; }
.integ-meta .status { font-size: 12px; }
.integ-meta button.link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; cursor: pointer; }
.integ-meta small { flex-basis: 100%; }
.status.off::before { background: var(--t-ag-c); }
.integ-note { margin: 0; padding: 12px 16px 0; font-size: 12.5px; overflow-wrap: anywhere; }
.integ-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; }
@media (max-width: 700px) {
    .integ-row { grid-template-columns: minmax(0, 1fr); }
    .integ-row > .field-l { padding-top: 0; }
    .integ-meta { grid-column: 1; }
}

/* ============ Menu: grupos e telas baixas ============ */
.rail-sep { flex: none; width: 24px; height: 1px; margin: 4px auto; background: rgba(255, 255, 255, .12); }
.rail-foot { flex: none; }
@media (min-width: 861px) and (max-height: 780px) {
    .rail { padding: 8px 0; gap: 4px; }
    .rail-items { gap: 2px; }
    .rail-items a, .rail-foot a, .rail-foot button { width: 36px; height: 34px; border-radius: 10px; }
    .rail-items .brand-home, .rail-items .brand-home.on { margin-bottom: 6px; }
    .rail-foot { gap: 2px; }
    .rail-sep { margin: 2px auto; }
    .me { width: 30px; height: 30px; margin-top: 2px; font-size: 11px; }
}
@media (min-width: 861px) and (max-height: 640px) {
    .rail-items a, .rail-foot a, .rail-foot button { height: 29px; }
    .rail-items .i, .rail-foot .i { width: 18px; height: 18px; }
    .rail-items .brand-home, .rail-items .brand-home.on { height: 34px; margin-bottom: 4px; }
    .me { width: 26px; height: 26px; }
}
@media (min-width: 861px) and (max-height: 540px) {
    /* Último recurso: o menu rola em vez de cortar o rodapé. */
    .rail { overflow-y: auto; scrollbar-width: none; }
    .rail-items { flex: none; }
}
@media (max-width: 860px) {
    .rail-sep { width: 1px; height: 28px; margin: auto 2px; }
    .rail-items { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
    .rail-items::-webkit-scrollbar { display: none; }
    .rail-items a { flex: 1 0 auto; }
}
.integ-card .card-head { display: grid; gap: 2px; justify-content: start; }
@media (max-width: 860px) {
    /* Admin: os itens de configuração continuam à direita; o esmaecido indica que a barra rola. */
    .rail-items:has(.rail-sep) { mask-image: linear-gradient(to right, #000 80%, transparent); -webkit-mask-image: linear-gradient(to right, #000 80%, transparent); }
}

/* ============ Conexão e Agente: configuração no próprio lugar ============ */
.provider-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; padding: 14px 16px 0; }
.provider-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.provider-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.provider-opt.off { opacity: .6; cursor: not-allowed; }
.provider-opt input { margin-top: 3px; accent-color: var(--brand); }
.provider-opt b { display: block; font-size: 14px; }
.provider-opt small { display: block; margin-top: 3px; color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.conn-more > summary, .conn-adv > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 14px; }
.conn-adv > summary { padding: 10px 16px; font-size: 13px; color: var(--ink-2); }
.meta-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 16px 6px; }
.meta-config-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 3px 12px rgba(0, 0, 0, .08); }
.meta-config-wide { grid-column: 1 / -1; }
.meta-config-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.meta-config-head .brand-mark { flex: none; }
.meta-config-head h3 { margin: 0; font-size: 14px; }
.meta-config-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.meta-config-content { padding: 0 14px; }
.meta-config-content .integ-row { grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); padding-left: 0; padding-right: 0; }
.meta-webhook-card .webhook-box { margin: 0; padding: 14px; border: 0; border-radius: 0; }
.meta-webhook-card .setup-steps { margin: 0 14px 14px; }
@media (max-width: 760px) { .meta-config-grid { grid-template-columns: minmax(0, 1fr); } .meta-config-wide { grid-column: auto; } }
.meta-status { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.webhook-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.webhook-box p { margin: 3px 0 0; font-size: 12.5px; }
.setup-steps { display: grid; gap: 6px; margin: 12px 16px 0; padding: 0; list-style: none; font-size: 13px; }
.setup-steps li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--t-ap-bg); color: var(--t-ap); }
.setup-steps li.fail { background: var(--t-ag-bg); color: var(--t-ag); }
.setup-steps span { color: var(--ink-2); overflow-wrap: anywhere; }
.conn-note { margin: 0; padding: 12px 16px 16px; font-size: 12.5px; }
.ai-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 10px; margin-top: 6px; }
.ai-provider { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 400; }
.ai-provider.on { border-color: var(--brand); background: var(--brand-soft); }
.ai-provider-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ai-provider-head input { accent-color: var(--brand); }
.ai-provider-head em { margin-inline-start: auto; font-style: normal; font-size: 12px; color: var(--ink-3); }
.ai-provider.on .ai-provider-head em { color: var(--brand-ink); font-weight: 600; }
.ai-provider small { font-size: 12px; line-height: 1.45; }
.ai-provider .integ-row { grid-template-columns: minmax(0, 1fr); padding: 6px 0 0; border: 0; }
.ai-provider .integ-row > .field-l { padding-top: 0; font-size: 12.5px; }
.ai-provider .integ-meta { grid-column: 1; }
.provider-opts { padding-bottom: 14px; }
.provider-opt.pending em { font-style: normal; color: var(--t-pe); }
.provider-hint { margin: 0 16px 14px; padding: 8px 10px; border-radius: 8px; background: var(--t-pe-bg); color: var(--t-pe); font-size: 13px; }
.provider-hint[hidden] { display: none; }
.conn-tabs { margin: 14px 0 0; }
.conn-tabs button { height: 36px; font-size: 13px; }
.conn-tab { margin-top: 10px; }
.conn-tab[hidden] { display: none; }
.conn-tab > .card + .card, .conn-tab > .card + details, .conn-tab > details + .card, .conn-tab > .flash + .card { margin-top: 14px; }

/* ============ Marcas dos provedores (Meta, Evolution, Gemini, Claude) ============ */
.brand-mark { flex: none; width: var(--bm, 40px); height: var(--bm, 40px); border-radius: 28%; display: grid; place-items: center; }
.brand-mark svg { display: block; }
.bm-meta { background: color-mix(in srgb, #0082fb 13%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #0082fb 28%, transparent); }
.bm-qr { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 14px -6px rgba(139, 92, 246, .7), inset 0 1px 0 rgba(255, 255, 255, .25); }
.bm-gemini { background: color-mix(in srgb, #8b6cf6 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #8b6cf6 26%, transparent); }
.bm-claude { background: color-mix(in srgb, #d97757 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #d97757 28%, transparent); }
.brand-title { display: flex; align-items: center; gap: 10px; }
.brand-title .muted { font-weight: 500; font-size: 12px; }

/* Cartões de escolha do provedor */
.provider-opts { gap: 12px; padding: 16px; }
.provider-opt { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 16px 44px 16px 16px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s, background .15s; }
.provider-opt:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow); }
.provider-opt input { position: absolute; opacity: 0; pointer-events: none; }
.provider-opt:has(input:focus-visible) { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.provider-opt:has(input:checked) { border-color: var(--brand); background: linear-gradient(135deg, var(--brand-soft), var(--surface) 70%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow-sm); }
.provider-opt b { display: inline; font-size: 15px; letter-spacing: -.01em; }
.provider-sub { display: block; margin-top: 1px; font-style: normal; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); text-transform: uppercase; }
.provider-opt small { margin-top: 6px; }
.provider-pending { font-style: normal; color: var(--t-pe); font-weight: 600; }
.provider-check { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); color: transparent; transition: .15s; }
.provider-opt:has(input:checked) .provider-check { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 4px 10px -4px var(--brand); }
.provider-opt.pending:not(:has(input:checked)) { background: var(--surface-3); }

/* Abas e títulos da Conexão */
.conn-tabs { padding: 4px; }
.conn-tabs button { gap: 8px; height: 38px; padding: 0 14px; }
.conn-tabs button svg.bg-qr { color: var(--brand-ink); }
.tab-badge { margin-inline-start: 2px; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.conn-icon svg.bg-qr { color: currentColor; }
.conn-more > summary { display: flex; align-items: center; gap: 8px; }
.conn-more > summary .i { color: var(--ink-3); }
.meta-status { align-items: center; background: color-mix(in srgb, #0082fb 5%, var(--surface)); }
.webhook-box { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; border-style: solid; background: var(--surface-3); }
.webhook-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, #0082fb 13%, var(--surface)); color: #0082fb; }
@media (max-width: 600px) { .webhook-box { grid-template-columns: auto minmax(0, 1fr); } .webhook-box .btn { grid-column: 1 / -1; justify-content: center; } }

/* Selo do canal na conversa */
.head-channel { gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; }
.head-channel.ch-meta { background: color-mix(in srgb, #0082fb 13%, var(--surface)); color: color-mix(in srgb, #0064e0 80%, var(--ink)); }
.head-channel.ch-evolution { background: var(--brand-soft); color: var(--brand-ink); }

/* Provedores de IA */
.ai-provider { padding: 14px; border-width: 1.5px; border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.ai-provider.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.ai-provider-head { gap: 10px; }
.ai-provider-head b { font-size: 14.5px; }
/* Cartão cuja configuração está aberta (sem ser o principal) */
.provider-opt.viewing:not(:has(input:checked)) { border-style: dashed; border-color: var(--brand); }
.provider-opt.viewing::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg); background: inherit; border-right: inherit; border-bottom: inherit; border-color: inherit; border-style: inherit; border-top: 0; border-left: 0; }
.provider-card { overflow: visible; }
@media (max-width: 640px) { .provider-opt.viewing::after { display: none; } }

/* ==========================================================================
   Automações (Fase 4): lista de fluxos + editor visual por blocos
   ========================================================================== */
.fx { padding-bottom: 24px; }
.fx-home { max-width: 1240px; }
.fx-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.fx-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; }
.fx-control b { display: block; font-size: 14px; }
.fx-control small { display: block; margin-top: 2px; color: var(--ink-2); font-size: 12.5px; }
.fx-control-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--t-ap-bg); color: var(--t-ap-c); }
#fx-engine.off .fx-control-icon { background: var(--t-pe-bg); color: var(--t-pe-c); }
#fx-send .fx-control-icon { background: var(--surface-2); color: var(--ink-3); }
#fx-send.on .fx-control-icon { background: var(--t-ag-bg); color: var(--t-ag-c); }
#fx-send.on { border-color: color-mix(in srgb, var(--t-ag-c) 45%, var(--line)); }
.fx-kpis { margin: 14px 0 6px; }

/* Interruptor */
.fx-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; }
.fx-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fx-switch span { width: 40px; height: 23px; border-radius: 999px; background: var(--line); position: relative; transition: background .18s; }
.fx-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s; }
.fx-switch input:checked + span { background: var(--brand); }
.fx-switch input:checked + span::after { transform: translateX(17px); }
.fx-switch input:focus-visible + span { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.fx-switch input:disabled + span { opacity: .5; }
.fx-switch em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fx-switch.big span { width: 46px; height: 26px; }
.fx-switch.big span::after { width: 20px; height: 20px; }
.fx-switch.big input:checked + span::after { transform: translateX(20px); }

/* Lista */
.fx-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.fx-list-head h2 { margin: 0; font-size: 16px; }
.fx-search { max-width: 260px; }
.fx-list { display: grid; gap: 10px; }
.fx-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.fx-item:hover { box-shadow: var(--shadow); }
.fx-item.on { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.fx-item-main { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.fx-item-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.fx-item-text { min-width: 0; }
.fx-item-text b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-item-text small { display: block; color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-item-text em { font-style: normal; color: var(--t-pe); font-weight: 600; }
.fx-item-stats { display: flex; gap: 4px; }
.fx-item-stats span { min-width: 74px; padding: 6px 8px; border-radius: 10px; background: var(--surface-3); font-size: 11px; color: var(--ink-3); text-align: center; }
.fx-item-stats b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.fx-item-stats .bad b { color: var(--t-ag-c); }
.fx-item-menu { display: flex; gap: 2px; }
.fx-empty { display: grid; justify-items: center; gap: 6px; padding: 48px 16px; border: 1.5px dashed var(--line); border-radius: 16px; text-align: center; }
.fx-empty span { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.fx-empty h3 { margin: 8px 0 0; }
.fx-empty p { margin: 0 0 8px; color: var(--ink-2); }
.fx-loading { display: flex; gap: 10px; align-items: center; padding: 24px; color: var(--ink-3); }
@media (max-width: 900px) {
    .fx-item { grid-template-columns: auto minmax(0, 1fr) auto; }
    .fx-item-stats { grid-column: 1 / -1; order: 3; }
    .fx-item-stats span { flex: 1; min-width: 0; }
}

/* Tons dos blocos */
.tone-trigger { --tone: #8b5cf6; }
.tone-condition { --tone: #f59e0b; }
.tone-wait { --tone: #3b82f6; }
.tone-whats { --tone: #22c55e; }
.tone-notify { --tone: #14b8a6; }
.tone-crm { --tone: #64748b; }
.tone-ai { --tone: #a855f7; }
.tone-meta { --tone: #0082fb; }
.tone-action { --tone: #22c55e; }
.fx-item-icon, .fx-model-icon, .fx-node-icon { background: color-mix(in srgb, var(--tone, var(--brand)) 15%, var(--surface)); color: var(--tone, var(--brand)); }

/* Galeria */
.fx-gallery { width: min(860px, 94vw); }
.fx-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fx-model { display: grid; gap: 6px; justify-items: start; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; transition: .15s; font: inherit; }
.fx-model:hover, .fx-model:focus-visible { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); outline: none; }
.fx-model-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.fx-model b { font-size: 14px; }
.fx-model small { color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }

/* Editor */
body.fx-editing .view.fx { padding: 0; overflow: hidden; display: flex; }
.fx-editor { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.fx-editor[hidden] { display: none; }
.fx-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.fx-name { flex: 1 1 220px; min-width: 0; padding: 7px 10px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--ink); font: 700 17px/1.2 inherit; letter-spacing: -.02em; }
.fx-name:hover { border-color: var(--line); }
.fx-name:focus { border-color: var(--brand); outline: none; background: var(--surface-3); }
.fx-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.fx-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.fx-state i.ok { background: var(--t-ap-c); }
.fx-state i.dirty { background: var(--t-pe-c); }
.fx-state i.pending { background: var(--t-ca-c); }
.fx-state .link { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.fx-top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-error { margin: 10px 16px 0; }
.fx-work { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.fx-canvas { position: relative; overflow: auto; background-color: var(--bg); background-image: radial-gradient(color-mix(in srgb, var(--ink-3) 35%, transparent) 1px, transparent 1px); background-size: 22px 22px; cursor: grab; }
.fx-canvas.grab { cursor: grabbing; user-select: none; }
.fx-graph { display: flex; justify-content: center; min-width: max-content; padding: 36px 48px 120px; transform-origin: top center; transition: transform .15s; }
.fx-zoom { position: sticky; left: 14px; bottom: 14px; float: left; display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); margin: -54px 0 0 14px; }
.fx-zoom button { min-width: 38px; height: 34px; border: 0; background: none; color: var(--ink-2); font: 600 13px inherit; cursor: pointer; }
.fx-zoom button:hover { background: var(--hover); color: var(--ink); }

/* Blocos e conexões */
.fx-col { display: flex; flex-direction: column; align-items: center; }
.fx-node { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; width: 300px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.fx-node::before { content: ""; position: absolute; left: -1.5px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone); }
.fx-node:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.fx-node:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.fx-node.sel { border-color: var(--tone); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 20%, transparent), var(--shadow); }
.fx-node.visited { border-color: var(--t-ap-c); }
.fx-node.bad { border-color: var(--t-ag-c); }
.fx-node-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.fx-node-body { min-width: 0; display: grid; gap: 1px; }
.fx-node-body small { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tone); }
.fx-node-body b { font-size: 13.5px; line-height: 1.3; }
.fx-node-body span { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fx-tag-tpl { display: inline-flex; align-items: center; gap: 3px; font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; color: #0082fb; }
.fx-tag-tpl svg { width: 13px; height: 13px; }
.fx-node-visit { position: absolute; top: -9px; right: 10px; padding: 1px 8px; border-radius: 999px; background: var(--t-ap-c); color: #fff; font-size: 11px; font-weight: 700; }
.fx-node-err { position: absolute; top: -9px; right: 10px; padding: 1px 8px; border-radius: 999px; background: var(--t-ag-c); color: #fff; font-size: 11px; font-weight: 700; }
.fx-node-stats { position: absolute; bottom: -10px; right: 10px; display: flex; gap: 3px; }
.fx-node-stats i { padding: 1px 7px; border-radius: 999px; font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.fx-node-stats i.passed { background: var(--t-ap-bg); color: var(--t-ap); }
.fx-node-stats i.failed { background: var(--t-ag-bg); color: var(--t-ag); }
.fx-node-stats i.waiting { background: var(--t-ca-bg); color: var(--t-ca); }
.fx-link { position: relative; display: grid; place-items: center; height: 46px; width: 2px; }
.fx-link::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: color-mix(in srgb, var(--ink-3) 55%, transparent); }
.fx-add { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-3); cursor: pointer; opacity: .75; transition: .15s; }
.fx-add:hover, .fx-add:focus-visible { opacity: 1; border-color: var(--brand); background: var(--brand); color: var(--on-brand); transform: scale(1.12); outline: none; }
.fx-end { padding: 6px 14px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-size: 12px; font-weight: 600; }
.fx-end.small { padding: 2px 10px; font-size: 11px; background: none; }
.fx-split { position: relative; display: flex; gap: 28px; padding-top: 22px; }
.fx-split::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 22px; transform: translateX(-1px); background: color-mix(in srgb, var(--ink-3) 55%, transparent); }
.fx-branch { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 20px; }
.fx-branch::before { content: ""; position: absolute; top: 0; height: 2px; background: color-mix(in srgb, var(--ink-3) 55%, transparent); }
.fx-branch.then::before { left: 50%; right: -14px; }
.fx-branch.else::before { right: 50%; left: -14px; }
.fx-branch::after { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 20px; transform: translateX(-1px); background: color-mix(in srgb, var(--ink-3) 55%, transparent); }
.fx-branch-label { position: absolute; top: 6px; left: calc(50% + 8px); z-index: 1; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.fx-branch.then .fx-branch-label { background: var(--t-ap-bg); color: var(--t-ap); }
.fx-branch.else .fx-branch-label { background: var(--t-ag-bg); color: var(--t-ag); }
.fx-branch > .fx-col > .fx-link:first-child { height: 30px; }

/* Seletor */
.fx-picker { position: fixed; z-index: 60; width: 340px; max-height: 420px; display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.fx-picker[hidden] { display: none; }
.fx-picker-list { overflow: auto; display: grid; gap: 2px; }
.fx-picker-group { margin: 8px 6px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.fx-pick { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.fx-pick:hover, .fx-pick:focus-visible { background: var(--hover); outline: none; }
.fx-pick .fx-node-icon { width: 32px; height: 32px; border-radius: 9px; }
.fx-pick b { display: block; font-size: 13px; }
.fx-pick small { display: block; font-size: 11.5px; color: var(--ink-3); }
.fx-picker-none { padding: 10px; }

/* Painel de configuração */
.fx-inspector { display: flex; flex-direction: column; min-height: 0; overflow: auto; border-left: 1px solid var(--line); background: var(--surface); }
.fx-ins-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.fx-ins-head small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tone); }
.fx-ins-head b { font-size: 15px; }
.fx-ins-head .fx-node-icon { background: color-mix(in srgb, var(--tone) 15%, var(--surface)); color: var(--tone); }
.fx-ins-body { display: grid; gap: 14px; padding: 16px; }
.fx-ins-body .field-l { display: grid; gap: 6px; }
.fx-hint { font-size: 12px; }
.fx-note { margin: 0; padding: 9px 11px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.fx-ins-actions { display: flex; gap: 8px; padding: 0 16px 18px; margin-top: auto; }
.btn.danger { color: var(--t-ag); }
.fx-vars { display: flex; flex-wrap: wrap; gap: 5px; margin-top: -6px; }
.fx-var { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font: 600 11.5px inherit; cursor: pointer; }
.fx-var:hover { border-color: var(--brand); color: var(--brand-ink); }
.fx-variants { display: grid; gap: 8px; }
.fx-variant { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.fx-add-variant { justify-self: start; border: 0; background: none; padding: 0; font: 600 12.5px inherit; cursor: pointer; margin-top: -4px; }
.fx-preview { padding: 14px; border-radius: 14px; background: var(--wa-bg); background-image: radial-gradient(var(--wa-dots) 1px, transparent 1px); background-size: 14px 14px; }
.fx-preview-label { display: block; margin-bottom: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--wa-meta); }
.fx-bubble { position: relative; max-width: 88%; margin-left: auto; padding: 7px 10px 18px; border-radius: 10px 0 10px 10px; background: var(--wa-out); color: var(--ink); font-size: 13.5px; line-height: 1.4; box-shadow: var(--bubble-shadow); overflow-wrap: anywhere; }
.fx-bubble time { position: absolute; right: 8px; bottom: 3px; font-size: 10.5px; color: var(--wa-meta); }
.fx-provider-box { display: grid; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.fx-provider-head { display: flex; gap: 10px; align-items: flex-start; }
.fx-provider-head b { display: block; font-size: 13.5px; }
.fx-provider-head small { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.fx-tpl { display: grid; gap: 10px; }
.fx-tpl .field-l .link { justify-self: start; border: 0; background: none; padding: 0; font: 600 12px inherit; cursor: pointer; }
.fx-tpl-body { padding: 10px; border-radius: 10px; background: var(--surface-3); }
.fx-tpl-body p { margin: 4px 0 0; font-size: 13px; white-space: pre-wrap; }
.fx-trace { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; font-size: 13px; }
.fx-trace li em { margin-left: 6px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--brand-ink); }
.fx-trace li span { display: block; color: var(--ink-2); white-space: pre-wrap; font-size: 12.5px; }
.fx-run { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.fx-run summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; cursor: pointer; }
.fx-run .fx-trace { margin-top: 10px; }
.fx-hist-filter { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.fx-sim-fields { display: grid; gap: 12px; margin: 14px 0; }

@media (max-width: 1100px) { .fx-work { grid-template-columns: minmax(0, 1fr) 330px; } }
@media (max-width: 860px) {
    .fx-work { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(260px, 1fr) auto; }
    .fx-inspector { border-left: 0; border-top: 1px solid var(--line); max-height: 52vh; }
    .fx-node { width: 260px; }
    .fx-top-actions .btn span { display: none; }
    body.fx-editing .rail { display: none; }
}
.tone-bot { --tone: #ec4899; }
.fx-options { display: grid; gap: 6px; }
.fx-option { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.fx-option > span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--ink-2); }
.fx-buttons { display: grid; gap: 4px; max-width: 88%; margin: 4px 0 0 auto; }
.fx-buttons span { padding: 7px; border-radius: 10px; background: var(--wa-out); color: var(--wa-link); text-align: center; font-size: 13px; font-weight: 600; box-shadow: var(--bubble-shadow); }
.fx-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fx-agent-test { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--wa-bg); background-image: radial-gradient(var(--wa-dots) 1px, transparent 1px); background-size: 14px 14px; }
.fx-agent-chat { display: grid; gap: 6px; max-height: 260px; overflow: auto; min-height: 40px; }
.fx-msg { max-width: 85%; padding: 7px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4; box-shadow: var(--bubble-shadow); overflow-wrap: anywhere; }
.fx-msg.in { justify-self: start; background: var(--wa-in); border-top-left-radius: 0; }
.fx-msg.out { justify-self: end; background: var(--wa-out); border-top-right-radius: 0; }
.fx-msg.sys { justify-self: center; max-width: 100%; background: var(--t-pe-bg); color: var(--t-pe); font-size: 12px; box-shadow: none; }
.fx-msg.typing { opacity: .6; }
.fx-agent-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }

/* ==========================================================================
   Acabamento geral (11/11/2026): tipografia, componentes, menu e movimento.
   Fica no fim do arquivo de propósito: padroniza todas as telas de uma vez.
   ========================================================================== */
:root { --display: var(--font-display); --radius: 14px; --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
body { font-feature-settings: "cv11", "ss01", "ss03"; text-rendering: optimizeLegibility; }
h1, h2, h3, .view-head h1, .card-head h2, .crm-dialog h2, .kpi b, .fx-name, .provider-opt b { font-family: var(--display); }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

/* Cabeçalho das páginas */
.view { padding-top: 28px; }
.view-head { align-items: center; margin-bottom: 20px; }
.view-head h1 { font-size: 25px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.view-head p { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.view-head p b { color: var(--ink-2); font-weight: 600; }
.view-in { animation: shk-rise .28s ease-out both; }
@keyframes shk-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Cartões */
.card { border-radius: var(--radius); border-color: color-mix(in srgb, var(--line) 85%, transparent); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px -6px rgba(15, 23, 42, .08); }
.card-head { padding: 14px 18px; gap: 14px; }
.card-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.card-head small { font-size: 12px; }
.pad { padding: 18px; }
.card + .card, .card + .grid2, .grid2 + .card { margin-top: 16px; }
.grid2 { gap: 16px; }

/* Botões e campos */
.btn { height: 38px; padding: 0 16px; border-radius: 10px; font-size: 13.5px; letter-spacing: -.005em; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .14); transition: background .15s, box-shadow .15s, border-color .15s, transform .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn:active { transform: translateY(0); }
.btn.ghost { box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.btn.ghost:hover { border-color: color-mix(in srgb, var(--ink-3) 45%, var(--line)); box-shadow: 0 4px 12px -6px rgba(15, 23, 42, .25); }
.btn .i { opacity: .92; }
.icon-btn { border-radius: 10px; }
.input { height: 40px; border-radius: 10px; padding: 0 12px; font-size: 13.5px; background: var(--surface); }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; }
.input:hover:not(:focus) { border-color: color-mix(in srgb, var(--ink-3) 40%, var(--line)); }
.input:focus { box-shadow: var(--ring); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a97a6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.field-l { gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.flash { border-radius: 12px; padding: 11px 14px; }
.chip { border-radius: 999px; padding: 0 9px; height: 22px; }

/* KPIs e tabelas */
.kpis { gap: 14px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--brand)); opacity: .85; }
.kpi small { text-transform: uppercase; letter-spacing: .05em; font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.kpi small i { display: none; }
.kpi b { margin-top: 8px; font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.kpi span { display: block; margin-top: 2px; font-size: 12px; }
.tbl th { padding: 10px 18px; font-size: 10.5px; letter-spacing: .06em; }
.tbl td { padding: 11px 18px; font-size: 13.5px; }
.tbl tbody tr { transition: background .12s; }
.bar i { height: 6px; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #22d3ee)); }

/* Segmentos e abas */
.seg { padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 85%, transparent); }
.seg-a, .seg label, .seg button { height: 32px; border-radius: 9px; }

/* Menu lateral: indicador do item ativo e dicas */
.rail { gap: 4px; box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04); }
.rail-items a, .rail-foot a, .rail-foot button { border-radius: 12px; transition: background .15s, color .15s, transform .12s; }
.rail-items a:hover, .rail-foot a:hover, .rail-foot button:hover { transform: translateY(-1px); }
.rail-items a.on:not(.brand-home) { background: rgba(34, 211, 238, .14); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .18); }
.rail-items a.on:not(.brand-home)::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); box-shadow: 0 0 10px rgba(34, 211, 238, .6); }
.rail [data-label]:hover::after { left: 54px; padding: 6px 10px; border-radius: 8px; font-weight: 600; background: #0b1220; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); animation: shk-tip .12s ease-out; }
@keyframes shk-tip { from { opacity: 0; transform: translate(-4px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
.rail-sep { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent); }
.me { box-shadow: 0 0 0 2px var(--rail), 0 0 0 3px rgba(255, 255, 255, .12); }
@media (max-width: 860px) {
    .rail-items a.on:not(.brand-home)::before { left: 50%; top: auto; bottom: -4px; width: 18px; height: 3px; transform: translateX(-50%); border-radius: 3px 3px 0 0; }
    .rail-items a.on:not(.brand-home) { box-shadow: none; background: none; }
    .rail-items a:hover, .rail-foot a:hover, .rail-foot button:hover { transform: none; }
    .view { padding-top: 18px; }
    .view-head h1 { font-size: 22px; }
}

/* Diálogos e gavetas */
.crm-dialog, .drawer, .push-dialog { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); }
.crm-dialog { border-radius: 20px; }
.eyebrow { letter-spacing: .08em; font-size: 10.5px; font-weight: 700; color: var(--brand-ink); }

/* Conversas: lista e cabeçalho mais limpos */
.pane-head h1 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; }
.row { transition: background .12s; }
.chat-head { box-shadow: 0 1px 0 var(--line); }

@media (prefers-reduced-motion: reduce) {
    .view-in, .rail [data-label]:hover::after { animation: none; }
    .btn:hover, .rail-items a:hover, .fx-node:hover, .provider-opt:hover { transform: none; }
}
.kpi:has(small i.t-aguardando) { --c: var(--t-ag-c); }
.kpi:has(small i.t-pendente) { --c: var(--t-pe-c); }
.kpi:has(small i.t-agendado) { --c: var(--t-ca-c); }
.kpi:has(small i.t-aprovado) { --c: var(--t-ap-c); }

/* Convites e regiões exclusivas */
.invite-box { display: grid; gap: 12px; padding: 16px 18px; margin-bottom: 16px; border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: linear-gradient(135deg, var(--brand-soft), var(--surface) 65%); }
.invite-box b { display: block; font-size: 15px; }
.invite-box small { color: var(--ink-2); font-size: 12.5px; }
.invite-link { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.invite-link .input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
@media (max-width: 640px) { .invite-link { grid-template-columns: 1fr 1fr; } .invite-link .input { grid-column: 1 / -1; } }
.team-actions { white-space: nowrap; }
.team-actions form { display: inline; }
.ufs label.taken span { opacity: .6; border-style: dashed; }
.new-hint { margin: 4px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.invite-card h1 { font-family: var(--display); }
.invite-show { font-size: 13px; }
/* Login e convite no celular: cartão cabe na tela e o logo aparece */
.auth { grid-template-columns: minmax(0, 380px); justify-content: center; }
.auth-card { width: 100%; }
.auth-card .logo { display: grid !important; place-items: center; color: #fff; background: var(--brand-grad); }

/* Notificações no painel */
.rail-badge { position: absolute; top: -4px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: #ef4444; color: #fff; font: 700 10.5px/1 var(--font); font-style: normal; box-shadow: 0 0 0 2px var(--rail), 0 4px 10px rgba(239, 68, 68, .5); animation: shk-pop .25s ease-out; }
.rail-badge[hidden] { display: none; }
@keyframes shk-pop { from { transform: scale(.4); } 70% { transform: scale(1.15); } to { transform: scale(1); } }
@media (max-width: 860px) { .rail-badge { top: 2px; right: calc(50% - 22px); } }
.shk-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.shk-toast { pointer-events: auto; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 36px 12px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .35); border-left: 4px solid var(--brand); animation: shk-in .28s cubic-bezier(.2, .9, .3, 1.2); transition: opacity .3s, transform .3s; }
.shk-toast.out { opacity: 0; transform: translateX(20px); }
.shk-toast:hover { border-color: var(--brand); }
.shk-toast-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 13px; }
.shk-toast-av img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.shk-toast-body { display: grid; gap: 1px; min-width: 0; }
.shk-toast-body b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shk-toast-body span { font-size: 13px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.shk-toast-body em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--brand-ink); margin-top: 2px; }
.shk-toast-x { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; }
.shk-toast-x:hover { background: var(--hover); color: var(--ink); }
@keyframes shk-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) { .shk-toasts { top: 12px; bottom: auto; right: 16px; } }
@media (prefers-reduced-motion: reduce) { .shk-toast, .rail-badge { animation: none; } }
.push-sound { font-size: 13.5px; }
.msg em.auto { color: var(--ink-3); font-style: italic; }

/* Etiquetas e selos sóbrios (público: mestres maçons 40+). Uma linha só, cantos retos, caixa alta. */
.chip { height: 20px; padding: 0 7px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink-3) 45%, transparent); }
.chip.tag::before { width: 6px; height: 6px; border-radius: 1px; }
.chip.t-aguardando, .chip.t-pendente, .chip.t-agendado, .chip.t-aprovado { background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent); }
.chip.inbox-urgent { background: color-mix(in srgb, var(--t-ag-c) 12%, transparent); color: var(--t-ag-c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-ag-c) 55%, transparent); }
.row .line3 { flex-wrap: nowrap; overflow: hidden; gap: 4px; mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); }
.row .line3 > .chip { flex: none; max-width: none; }
.row .line3 > .chip:last-child { max-width: none; }
/* Selo de doação: dourado, discreto */
.avatar .badge.donor { background: linear-gradient(145deg, #e3c26b, #b8912f); color: #1a1405; box-shadow: 0 0 0 2px var(--surface); }
.avatar .badge.donor .i { fill: none; stroke: currentColor; stroke-width: 3.2; width: 10px; height: 10px; }
/* Avatares menos saturados */
:root { --av-s: 32%; }
:root[data-theme="dark"] { --av-s: 18%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --av-s: 18%; } }
/* Etiquetas: um pouco mais encorpadas, com ícone de mapa na UF e de pessoa no mestre */
.chip { height: 22px; padding: 0 8px; gap: 5px; border-radius: 5px; font-size: 10.5px; letter-spacing: .05em; }
.chip .i { width: 12px; height: 12px; opacity: .85; stroke-width: 2.4; }
.chip.uf, .chip.owner { color: var(--ink-2); background: color-mix(in srgb, var(--ink-3) 8%, transparent); }
.chip.uf .i { color: var(--brand-ink); opacity: 1; }
.chip.donor-chip { color: #b8912f; background: color-mix(in srgb, #d4af37 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #d4af37 55%, transparent); }
:root[data-theme="dark"] .chip.donor-chip { color: #e3c26b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.donor-chip { color: #e3c26b; } }
.chip.donor-chip .i { stroke-width: 3; }
/* Foto de perfil do WhatsApp no avatar */
.avatar { position: relative; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.has-photo .avatar-ini { visibility: hidden; }
.avatar-ini { font-weight: inherit; display: contents; }

/* Player de áudio no estilo do WhatsApp Web */
.wa-audio { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 10px; width: 300px; max-width: 100%; padding: 6px 6px 2px 4px; }
.wa-audio-mic { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 18%, var(--surface-2)); color: var(--brand-ink); }
.wa-audio.out .wa-audio-mic { background: color-mix(in srgb, var(--brand) 26%, transparent); }
.wa-play { width: 34px; height: 34px; border: 0; padding: 0; background: none; color: var(--wa-meta); display: grid; place-items: center; cursor: pointer; border-radius: 50%; }
.wa-play:hover { color: var(--ink); }
.wa-track { display: grid; gap: 3px; min-width: 0; }
.wa-wave { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; outline-offset: 3px; }
.wa-wave i { flex: 1; min-width: 2px; max-width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--wa-meta) 55%, transparent); transition: background .12s; }
.wa-wave i.on { background: var(--wa-author); }
.wa-audio.in .wa-wave i.on { background: #53bdeb; }
.wa-info { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--wa-meta); font-variant-numeric: tabular-nums; }
.wa-speed { padding: 1px 7px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--wa-meta) 18%, transparent); color: var(--wa-meta); font: 700 10.5px var(--font); cursor: pointer; }
.wa-speed:hover { color: var(--ink); }
.wa-audio audio { display: none; }
.msg.has-media .wa-audio + .audio-transcript, .msg .audio-transcript { margin: 2px 8px 0 60px; }
/* Transcrição discreta */
.audio-transcript { display: block; gap: 0; color: var(--wa-meta); font-size: 12px; }
.audio-transcript summary { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; list-style: none; font-size: 11.5px; font-weight: 600; color: var(--wa-meta); user-select: none; }
.audio-transcript summary::-webkit-details-marker { display: none; }
.audio-transcript summary::before { content: "›"; display: inline-block; font-size: 14px; line-height: 1; transition: transform .15s; }
.audio-transcript[open] summary::before { transform: rotate(90deg); }
.audio-transcript summary:hover { color: var(--ink-2); }
.audio-transcript p { margin: 4px 0 2px; padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--wa-meta) 35%, transparent); font-style: italic; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-transcribe { padding: 0; border: 0; background: none; font: 600 11.5px var(--font); color: var(--wa-meta); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.wa-transcribe:hover { color: var(--ink-2); }
.audio-transcript small { margin-left: 6px; }
/* Etiquetas compactas e sérias (versão final): menores, sem fundo, contorno fino */
.chip { height: 18px; padding: 0 5px; gap: 3px; border-radius: 3px; font-size: 9.5px; font-weight: 700; letter-spacing: .045em; line-height: 1; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink-3) 38%, transparent); }
.chip .i { width: 10px; height: 10px; stroke-width: 2.6; }
.chip.tag::before { width: 5px; height: 5px; border-radius: 1px; }
.chip.t-aguardando, .chip.t-pendente, .chip.t-agendado, .chip.t-aprovado, .chip.inbox-urgent { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--t-ag-c)) 50%, transparent); }
.chip.uf, .chip.owner { background: transparent; color: var(--ink-3); }
.chip.uf .i { color: var(--ink-3); }
.chip.donor-chip { background: transparent; }
.row .line3 { gap: 3px; margin-top: 4px; }
.chips { gap: 4px; }

/* Gravação de áudio no composer */
.composer { position: relative; }
.rec-btn { color: var(--wa-meta); }
.rec-btn:hover { color: var(--brand-ink); }
.composer.recording .field, .composer.recording > .send, .composer.recording .rec-btn { display: none; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 6px; border-radius: 22px; background: var(--composer-field); }
.rec-bar[hidden] { display: none; }
.rec-cancel { color: var(--t-ag-c); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; color: var(--ink); }
.rec-label { flex: 1; color: var(--wa-meta); font-size: 13px; }
.rec-send { flex: none; }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
/* Respostas rápidas: só ao digitar "/" (sem atalho fixo acima do campo) */
.compose-tools:has(#mode-status:empty) { display: none; }
.quick-add { display: block; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--brand-ink); font-weight: 600; font-size: 13px; text-decoration: none; }
.quick-add:hover { background: var(--hover); }
/* Resumo da conversa com a identidade do agente de IA */
#inbox-brief-text { white-space: pre-line; }
.inbox-brief summary { display: flex; align-items: center; gap: 8px; list-style: none; }
.inbox-brief summary::-webkit-details-marker { display: none; }
.inbox-brief summary::after { content: "›"; margin-left: auto; color: var(--ink-3); font-size: 16px; transition: transform .15s; }
.inbox-brief[open] summary::after { transform: rotate(90deg); }
.brief-ai { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--ai-grad); color: #fff; box-shadow: 0 3px 10px -3px color-mix(in srgb, var(--ai-1) 70%, transparent); }
.brief-ai .i { width: 13px; height: 13px; }
.brief-badge { padding: 1px 6px; border-radius: 4px; font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: var(--ai-soft-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ai-1) 45%, transparent); }

/* Arquivos da conversa (dados do contato) */
.contact-files { display: grid; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.contact-files header { display: flex; align-items: baseline; justify-content: space-between; }
.contact-files header small { color: var(--ink-3); font-size: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.file-grid a { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.file-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.file-grid a:hover img { transform: scale(1.05); }
.file-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.file-row:hover { background: var(--hover); }
.file-ico { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, #ef4444 14%, var(--surface)); color: #dc2626; font: 800 10px var(--font); letter-spacing: .04em; }
.file-row b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row small { display: block; font-size: 11.5px; color: var(--ink-3); }

/* Visualizador de fotos e PDF */
.viewer { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto minmax(0, 1fr); background: rgba(8, 12, 16, .94); backdrop-filter: blur(4px); color: #e9edef; animation: shk-fade .18s ease-out; }
.viewer[hidden] { display: none; }
@keyframes shk-fade { from { opacity: 0; } to { opacity: 1; } }
.viewer header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.vw-title { flex: 1; min-width: 0; }
.vw-title b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-title small { color: #9fb0b9; font-size: 12px; }
.vw-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; background: rgba(255, 255, 255, .06); color: #e9edef; font: 600 13px var(--font); text-decoration: none; cursor: pointer; }
.vw-btn:hover { background: rgba(255, 255, 255, .14); }
.vw-close { width: 36px; padding: 0; justify-content: center; font-size: 16px; }
.vw-stage { display: grid; place-items: center; overflow: auto; padding: 0 60px 24px; min-height: 0; }
.vw-stage img { max-width: 100%; max-height: calc(100dvh - 90px); object-fit: contain; border-radius: 6px; cursor: zoom-in; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); transition: transform .2s; }
.vw-stage img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.vw-stage iframe { width: min(900px, 100%); height: calc(100dvh - 90px); border: 0; border-radius: 8px; background: #fff; }
.vw-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; z-index: 1; }
.vw-nav:hover { background: rgba(255, 255, 255, .18); }
.vw-nav.prev { left: 10px; }
.vw-nav.next { right: 10px; }
body.viewing { overflow: hidden; }
@media (max-width: 640px) { .vw-stage { padding: 0 8px 12px; } .vw-nav { width: 36px; height: 52px; font-size: 28px; } }
.file-grid a.broken { display: grid; place-items: center; color: var(--ink-3); font-size: 10px; text-align: center; padding: 4px; } .file-grid a.broken::after { content: "Indisponível"; }

/* ==========================================================================
   Dados do contato: ordem por importância, blocos compactos e consistentes
   ========================================================================== */
#info-body { display: grid; gap: 0; align-content: start; }
.hero.hero-compact { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 16px; text-align: left; border-bottom: 1px solid var(--line); }
.hero-compact .avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.hero-compact h3 { margin: 0; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-compact p { margin: 1px 0 6px; font-size: 12.5px; color: var(--ink-3); }
.hero-compact .chips { justify-content: flex-start; margin: 0; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
/* Leitura do agente em destaque, logo abaixo do cabeçalho */
#info-body .agent-card { margin: 12px 12px 4px; padding: 12px 14px; }
#info-body .agent-card .ag-verdict { font-size: 15px; margin: 6px 0 2px; }
#info-body .agent-card .ag-meta { font-size: 11.5px; }
#info-body .agent-card .ag-btn { margin-top: 8px; height: 28px; font-size: 11.5px; }
.psec { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; }
.psec-title { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.psec .stage-pick { padding: 0; border: 0; }
.psec .stage-pick .label { display: none; }
.journey.compact { padding: 0; border: 0; margin: 0; }
.journey.compact .steps { margin-top: 2px; }
.journey.compact .steps-l { font-size: 10.5px; }
.psec select.input { height: 36px; font-size: 13px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 1px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Blocos que abrem e fecham */
.fold > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); user-select: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary em { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-size: 10.5px; letter-spacing: 0; }
.fold > summary::after { content: "›"; margin-left: auto; font-size: 16px; transition: transform .15s; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold > summary:hover { color: var(--ink-2); }
.fold[open] { gap: 10px; }
.btn.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; justify-self: start; }
.contact-note-history { display: grid; gap: 6px; }
.contact-note-history article { padding: 8px 10px; border-radius: 10px; background: var(--surface-3); border-left: 3px solid var(--t-pe-c); }
.contact-note-history article p { margin: 0; font-size: 12.5px; white-space: pre-wrap; }
.contact-note-history footer { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.more-link { justify-self: start; border: 0; background: none; padding: 0; font: 600 12px var(--font); cursor: pointer; }
/* Arquivos: abas, 6 fotos e "ver todas" */
.contact-files { padding: 12px 16px; border-top: 0; }
.file-tabs { display: flex; gap: 4px; }
.file-tabs button { height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--ink-2); font: 600 11.5px var(--font); cursor: pointer; }
.file-tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.file-grid a { position: relative; }
.more-badge { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; font-size: 15px; font-weight: 700; }
.crm-timeline { padding: 0; }
#info-body .stage-note { display: none; }
/* Café: calendário de data e hora + local */
.stage-cafe { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.stage-cafe .cafe-field { display: grid; gap: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); min-width: 0; }
.stage-cafe .input { height: 38px; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.stage-cafe input[type="datetime-local"] { color-scheme: light dark; padding-right: 6px; }
.stage-cafe .btn { grid-column: 1 / -1; justify-self: start; height: 34px; }
@media (max-width: 420px) { .stage-cafe { grid-template-columns: 1fr; } }
.stage-opts button.pending { outline: 2px dashed var(--t-ca-c); outline-offset: 1px; }

/* ==========================================================================
   Menu: engrenagem (Configurações) e menu da conta
   ========================================================================== */
.rail-foot .rail-config.on { background: rgba(34, 211, 238, .14); color: var(--gold-2); }
.me-wrap { position: relative; }
button.me { border: 0; cursor: pointer; padding: 0; font: 600 12px var(--font); transition: box-shadow .15s; }
button.me:hover, button.me[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--rail), 0 0 0 4px var(--gold); }
.me-menu { position: absolute; left: 50px; bottom: 0; z-index: 70; width: 250px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .45); display: grid; gap: 2px; animation: shk-rise .16s ease-out; }
.me-menu[hidden] { display: none; }
.me-head { display: flex; align-items: center; gap: 10px; padding: 8px; }
.me-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: hsl(var(--h, 160) 40% 28%); color: hsl(var(--h, 160) 80% 90%); flex: none; }
.me-head b { display: block; font-size: 13.5px; }
.me-head small { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.me-role { margin: 0 8px 6px; justify-self: start; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.me-menu button, .me-menu a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--ink); font: 500 13.5px var(--font); text-decoration: none; cursor: pointer; text-align: left; }
.me-menu button:hover, .me-menu a:hover { background: var(--hover); }
.me-menu .i { color: var(--ink-3); }
.me-menu .moon, .me-menu .sun { display: inline-flex; }
.me-menu .me-out { color: var(--t-ag); border-top: 1px solid var(--line-2); border-radius: 0 0 9px 9px; margin-top: 4px; }
.me-menu .me-out .i { color: currentColor; }
.me-menu i { font-style: normal; }
:root[data-theme="dark"] .me-menu .moon { display: none; }
:root:not([data-theme="dark"]) .me-menu .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .me-menu .moon { display: none; } :root:not([data-theme="light"]) .me-menu .sun { display: inline-flex; } }
@media (max-width: 860px) {
    .me-wrap { display: flex; align-items: center; padding: 0 4px; }
    button.me { display: grid; width: 30px; height: 30px; margin: 0; }
    .me-menu { left: auto; right: 0; bottom: 56px; }
}

/* Abas de Configurações */
.settings-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: -4px 0 18px; }
.settings-crumb { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.settings-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 85%, transparent); }
.settings-tabs a { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.settings-tabs a:hover { color: var(--ink); }
.settings-tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.settings-tabs a .i { opacity: .75; }
@media (max-width: 700px) { .settings-tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; } .settings-tabs a { flex: none; } }

/* Central de Configurações */
.settings-group { margin-top: 18px; }
.settings-group h2 { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-family: var(--font); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.settings-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card + .settings-card { margin-top: 0; }
.settings-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow); }
.settings-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.settings-body { display: grid; gap: 3px; min-width: 0; }
.settings-body b { font-size: 14.5px; font-family: var(--display, Inter); }
.settings-body small { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.settings-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.settings-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.settings-status.ok::before { background: var(--t-ap-c); }
.settings-status.warn::before { background: var(--t-pe-c); }
.settings-status.off::before { background: var(--t-ag-c); }
.settings-go { font-size: 22px; color: var(--ink-3); }
.rail-foot .me-menu button, .rail-foot .me-menu a { width: auto; height: 38px; display: flex; place-items: initial; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 10px; color: var(--ink); background: none; border-radius: 9px; transform: none; white-space: nowrap; }
.rail-foot .me-menu button:hover, .rail-foot .me-menu a:hover { background: var(--hover); color: var(--ink); transform: none; }
.rail-foot .me-menu .me-out, .rail-foot .me-menu .me-out:hover { color: var(--t-ag); }
.rail-foot .me-menu [data-label]::after { display: none; }

/* ==========================================================================
   Densidade e sobriedade (referência: WhatsApp Web). Mais informação na tela,
   uma etiqueta por conversa, preenchida em tom suave, sem contorno nem ícone.
   ========================================================================== */
body { font-size: 13px; }
/* Só no computador: no celular o menu vira barra inferior e a lista ocupa a tela toda. */
@media (min-width: 861px) {
    .app { grid-template-columns: 56px minmax(0, 1fr); }
    .inbox { grid-template-columns: 56px 330px minmax(0, 1fr) auto; }
    .rail { padding: 10px 0; }
    .rail-items a, .rail-foot a, .rail-foot button { width: 38px; height: 38px; }
}
@media (min-width: 861px) and (max-width: 1279px) { .inbox { grid-template-columns: 56px 330px minmax(0, 1fr); } }
.rail-items .i, .rail-foot .i { width: 20px; height: 20px; }
/* Etiqueta de etapa: preenchida, pequena, caixa alta (como a do WhatsApp Business) */
.chip.tag, .chip.t-aguardando, .chip.t-pendente, .chip.t-agendado, .chip.t-aprovado { height: 17px; padding: 0 6px; border-radius: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; box-shadow: none; background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 80%, var(--ink)); }
.chip.tag::before { display: none; }
.chip.tag .i { width: 10px; height: 10px; }
.chip.inbox-urgent { box-shadow: none; background: color-mix(in srgb, var(--t-ag-c) 16%, transparent); }
/* Lista de conversas compacta */
.pane-head { padding: 12px 14px 8px; }
.pane-head h1 { font-size: 19px; }
.row { margin: 0 6px; padding: 7px 8px; gap: 10px; border-radius: 8px; }
.row .avatar { width: 42px; height: 42px; font-size: 14px; }
.line1 strong { font-size: 14px; }
.line1 time { font-size: 11.5px; }
.line2 small { font-size: 12.5px; }
.row .line3 { margin-top: 3px; align-items: center; gap: 6px; mask-image: none; -webkit-mask-image: none; }
.search { margin-top: 0; }
/* Conversa */
.chat-head { height: 52px; }
.msg { font-size: 13.5px; }
/* Páginas */
.view { padding-top: 20px; }
.view-head { margin-bottom: 14px; }
.view-head h1 { font-size: 22px; }
.card-head { padding: 11px 16px; }
.pad { padding: 14px; }
.tbl th { padding: 8px 14px; }
.tbl td { padding: 8px 14px; font-size: 13px; }
.kpi { padding: 13px 15px; }
.kpi b { font-size: 24px; margin-top: 6px; }
.btn { height: 34px; padding: 0 14px; font-size: 13px; }
.input { height: 36px; font-size: 13px; }
.field-l { font-size: 12px; }
@media (max-width: 860px) { .rail-items a, .rail-foot a, .rail-foot button { width: auto; height: 48px; } }

/* Escala de desktop: o mesmo efeito do "–" de zoom do navegador (95%, a pedido),
   aplicado só em telas grandes com mouse. Alturas de tela cheia são compensadas pela escala. */
@media (min-width: 1024px) and (pointer: fine) {
    /* Mesma escala em todas as páginas (o menu do editor de automações compensa o zoom no JS). */
    html { --ui-zoom: .95; zoom: var(--ui-zoom); }
    .app { height: calc(100vh / var(--ui-zoom, 1)); height: calc(100dvh / var(--ui-zoom, 1)); }
    .auth { min-height: calc(100dvh / var(--ui-zoom, 1)); }
    .vw-stage img { max-height: calc(100dvh / var(--ui-zoom, 1) - 90px); }
    .vw-stage iframe { height: calc(100dvh / var(--ui-zoom, 1) - 90px); }

    /* Piso de leitura: nada abaixo de ~9,5px na tela com a escala de 95%. */
    .eyebrow,
    .metric-context,
    .card-source,
    .crm-avatar.tiny,
    .card-donation span,
    .card-owner,
    .crm-card > footer time,
    .column-empty small,
    .column-limit,
    .pane-head .eyebrow,
    .owner-tabs b,
    .internal-note header span,
    .internal-note footer,
    .quick-menu > header small,
    .reply-state,
    .contact-notes > header small,
    .contact-note-history footer,
    .brief-badge { font-size: 10px; }
}

/* ==========================================================================
   Acabamento WhatsApp Web: rail claro e neutro, filtros em uma linha de pílulas,
   seleção cinza, etiqueta menor, cabeçalho e player de áudio mais discretos.
   ========================================================================== */
/* Filtros: uma linha só, pílulas pequenas como "Tudo · Não lidas · Grupos" */
.list-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; border-bottom: 1px solid var(--line); }
.list-filters .monitor-filters { display: contents; }
.list-filters select, .list-filters .status-filter select { flex: 0 1 auto; width: auto; max-width: 132px; height: 26px; padding: 0 22px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%238696a0' stroke-width='1.6'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center; -webkit-appearance: none; appearance: none; color: var(--ink-2); font: 500 12px var(--font); box-shadow: none; cursor: pointer; }
.list-filters select:hover { background-color: var(--hover); }
.list-filters .status-filter { display: contents; }
.list-filters .owner-tabs { margin: 0; padding: 0; border: 0; background: none; gap: 6px; flex: 0 0 auto; }
.list-filters .owner-tabs label { flex: none; }
.list-filters .owner-tabs label > span { height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 500; }
.list-filters .owner-tabs input:checked + span { background: var(--brand-soft); color: var(--brand-ink); box-shadow: none; }
.search { margin-bottom: 8px; height: 34px; border-radius: 8px; }
.pane-head { padding: 12px 14px 8px; }
.pane-head h1 { font-size: 20px; }

/* Lista: densa como o WhatsApp, mas com a assinatura do Shark — cartões arredondados
   e a conversa aberta em verde da marca com o filete à esquerda. */
.row { margin: 1px 6px; padding: 7px 10px; border-radius: 10px; }
.row.on { background: var(--brand-soft); box-shadow: inset 3px 0 var(--brand); }
.row:hover:not(.on) { background: var(--hover); }
.list-filters select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.list-filters select:has(option:checked:not([value=""]):not([value="all"])) { border-color: color-mix(in srgb, var(--brand) 55%, transparent); color: var(--brand-ink); background-color: var(--brand-soft); }
.row .avatar { width: 46px; height: 46px; }
.row .line3 .chip.tag .i { display: none; }

/* Etiquetas: todas no mesmo padrão (preenchidas em tom suave, sem contorno), com tamanho
   mínimo legível mesmo com a escala de 90% (10px × 0,9 ≈ 9px na tela). */
.chip, .chip.tag, .chip.t-aguardando, .chip.t-pendente, .chip.t-agendado, .chip.t-aprovado { height: 18px; padding: 0 6px; gap: 3px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; box-shadow: none; -webkit-font-smoothing: antialiased; }
.chip.uf, .chip.owner { background: color-mix(in srgb, var(--ink-3) 13%, transparent); color: var(--ink-2); box-shadow: none; }
.chip.uf .i, .chip.owner .i { width: 11px; height: 11px; color: var(--ink-3); opacity: 1; }
.row .line3 { flex-wrap: nowrap; overflow: hidden; }
.row .line3 > .chip.owner { min-width: 0; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

.inbox-brief { padding: 6px 16px; }
.inbox-brief summary { font-size: 12.5px; font-weight: 600; }

/* Áudio: tamanho do WhatsApp Web */
.wa-audio { width: 260px; gap: 6px; padding: 3px 4px 0 2px; }
.wa-audio-mic { width: 36px; height: 36px; }
.wa-audio-mic svg { width: 18px; height: 18px; }
.wa-play { width: 28px; height: 28px; }
.wa-wave { height: 22px; }
.wa-info { font-size: 10.5px; }

/* WhatsApp → Avisar se cair (pensado para quem tem 40+: dois campos e dois botões) */
.alert-simple { margin-top: 14px; }
.alert-simple .card-head h2 { display: flex; align-items: center; gap: 8px; }
.alert-simple-body { display: grid; gap: 12px; max-width: 520px; }
.alert-lead { margin: 0; font-size: 14px; color: var(--ink-2); }
.alert-simple .field-l { font-size: 13px; }
.alert-simple .input { height: 42px; font-size: 15px; }
.alert-tip { margin-top: -6px; font-size: 12px; color: var(--ink-3); }
.alert-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.alert-pill { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.alert-pill.up { background: color-mix(in srgb, #22c55e 15%, transparent); color: #15803d; }
.alert-pill.down { background: color-mix(in srgb, #ef4444 15%, transparent); color: #dc2626; }
:root[data-theme="dark"] .alert-pill.up { color: #4ade80; }
.alert-result { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert-result li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.alert-result li.ok { background: color-mix(in srgb, #22c55e 12%, transparent); }
.alert-result li.fail { background: color-mix(in srgb, #f59e0b 14%, transparent); }
.alert-result li span { color: var(--ink-2); }
.alert-more { border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; color: var(--ink-2); }
.alert-more summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.alert-more[open] { display: grid; gap: 10px; }
.alert-more p { margin: 6px 0 0; line-height: 1.5; }
.alert-log-t { font-size: 12px; color: var(--ink); }
.alert-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.alert-log li { display: flex; gap: 10px; }
.alert-log time { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Formatação do WhatsApp nas mensagens */
.msg .txt b { font-weight: 700; }
.wa-code { padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 8%, transparent); font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
.wa-pre { display: block; margin: 2px 0; padding: 6px 8px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 7%, transparent); font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.wa-list { margin: 2px 0; padding-left: 20px; white-space: normal; }
.wa-list li { margin: 1px 0; }
.wa-quote { display: block; margin: 2px 0; padding: 2px 8px; border-left: 3px solid color-mix(in srgb, var(--ink-3) 60%, transparent); color: var(--ink-2); }

/* Humor do cliente (IA): selo fixo com bolinha de cor, sóbrio como os demais chips. */
.chip.humor{--hc:#8a94a0;gap:5px;background:color-mix(in srgb,var(--hc) 13%,transparent);color:color-mix(in srgb,var(--hc) 78%,var(--ink))}
.chip.humor i{width:7px;height:7px;border-radius:50%;background:var(--hc);flex:none}
.chip.humor.h-animado{--hc:#1fa855}
.chip.humor.h-duvida{--hc:#d99a06}
.chip.humor.h-frio{--hc:#3b82c4}
.chip.humor.h-irritado{--hc:#e0453a}
.chat-head .who strong .chip.humor{margin-left:8px;vertical-align:2px;font-weight:600}

/* Agente lendo: discreto, em segundo plano (sem pílula sobre a conversa nem brilho no chip). */
.agent-chip.busy{animation-duration:6s}
.agent-chip.busy .ag-label{background:none;color:inherit;animation:none}
#ag-reading{display:none!important}

/* Café: Data e Hora separadas (calendário só da data; hora em lista) e Local na linha de baixo. */
.stage-cafe .cafe-field.wide{grid-column:1 / -1}
.stage-cafe input[type="date"]{color-scheme:light dark;padding-right:6px}
.stage-cafe select.input{padding-right:6px}
@media (max-width:420px){.stage-cafe{grid-template-columns:1fr 1fr}}

/* ==========================================================================
   Lista mais sóbria (11/11): filtros com lista própria, linhas compactas,
   seleção cinza do WhatsApp Web e etiquetas sem fundo colorido.
   ========================================================================== */
:root { --row-sel: #f0f2f5; --row-hover: #f5f6f6; }
:root[data-theme="dark"] { --row-sel: #2a3942; --row-hover: #202c33; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --row-sel: #2a3942; --row-hover: #202c33; } }

/* Filtros: três campos do mesmo tamanho, alinhados à busca */
.list-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 12px 10px; }
.list-filters:has(.owner-tabs) { display: flex; }
.list-filters .monitor-filters, .list-filters .status-filter { display: contents; }
.fsel { position: relative; min-width: 0; }
.fsel > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100%; height: 100%; }
.fsel-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; height: 32px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font: 500 12.5px var(--font); cursor: pointer; transition: background .12s, border-color .12s; }
.fsel-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsel-btn svg { flex: none; color: var(--ink-3); transition: transform .15s; }
.fsel-btn:hover { background: var(--row-hover); }
.fsel-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.fsel.open .fsel-btn { border-color: var(--ink-3); }
.fsel.open .fsel-btn svg { transform: rotate(180deg); }
.fsel.set .fsel-btn { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--brand-ink); background: var(--brand-soft); font-weight: 600; }
.fsel.set .fsel-btn svg { color: var(--brand-ink); }
.fsel-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 240px; max-height: 320px; overflow-y: auto; padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(11, 20, 26, .16), 0 2px 6px rgba(11, 20, 26, .08); animation: fade .12s; }
.list-filters > :last-child .fsel-menu, .list-filters .status-filter .fsel-menu { left: auto; right: 0; }
.fsel-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: 400 13px var(--font); text-align: left; cursor: pointer; }
.fsel-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsel-opt b { flex: none; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.fsel-opt:hover, .fsel-opt:focus-visible { background: var(--row-hover); outline: none; }
.fsel-opt.on { background: var(--row-sel); font-weight: 600; }
.fsel-opt.on::after { content: ""; flex: none; width: 10px; height: 6px; margin-left: -4px; border: solid var(--brand); border-width: 0 0 2px 2px; transform: rotate(-45deg) translateY(-2px); }
.fsel-opt.on b + ::after { display: none; }
.fsel-opt.all { color: var(--ink-2); }
.fsel-grid .fsel-menu { display: grid; grid-template-columns: repeat(4, 44px); gap: 2px; max-width: none; }
.fsel-grid .fsel-opt { justify-content: center; padding: 0; font-size: 12.5px; }
.fsel-grid .fsel-opt.all { grid-column: 1 / -1; justify-content: flex-start; padding: 0 10px; }
.fsel-grid .fsel-opt.on::after { display: none; }
.fsel-grid .fsel-opt.on { background: var(--brand-soft); color: var(--brand-ink); }

/* Linhas compactas, seleção cinza como no WhatsApp Web */
.row { margin: 0 6px; padding: 6px 10px; gap: 11px; border-radius: 8px; align-items: center; }
.row .avatar { width: 40px; height: 40px; font-size: 14px; }
.row .line1 strong { font-size: 14.5px; font-weight: 500; }
.row.unread .line1 strong { font-weight: 600; }
.row .line2 small { font-size: 13px; }
.row .line3 { margin-top: 2px; gap: 8px; }
.row:hover:not(.on) { background: var(--row-hover); }
.row.on { background: var(--row-sel); box-shadow: none; }

/* Etiquetas da lista: bolinha de cor + texto, sem fundo nem caixa alta */
.row .line3 .chip, .row .line3 .chip.tag, .row .line3 .chip.t-aguardando, .row .line3 .chip.t-pendente, .row .line3 .chip.t-agendado, .row .line3 .chip.t-aprovado, .row .line3 .chip.inbox-urgent { height: 16px; padding: 0; gap: 4px; background: none; box-shadow: none; border-radius: 0; text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.row .line3 .chip.tag::before { display: inline-block; content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.row .line3 .chip.tag { color: var(--ink-2); }
.row .line3 .chip.uf .i, .row .line3 .chip.owner .i { width: 11px; height: 11px; color: var(--ink-3); }
.row .line3 .chip.inbox-urgent { color: var(--t-ag-c); }

/* Humor só no resumo, escrito por extenso (sem repetir selo no topo e nos dados do contato). */
.brief-humor:empty { display: none; }
.inbox-brief-signals { align-items: center; }
.humor-line { --hc: #8a94a0; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.humor-line i { width: 8px; height: 8px; border-radius: 50%; background: var(--hc); flex: none; }
.humor-line b { color: var(--ink); font-weight: 600; }
.humor-line em { font-style: normal; color: var(--ink-3); }
.humor-line.h-animado { --hc: #1fa855; } .humor-line.h-duvida { --hc: #d99a06; } .humor-line.h-frio { --hc: #3b82c4; } .humor-line.h-irritado { --hc: #e0453a; }
.contact-hero .chips:empty, .chips:empty { display: none; }

/* Etiquetas dentro da conversa no estilo das etiquetas do WhatsApp: cor da etapa bem suave,
   texto normal (sem caixa alta), pílula arredondada e sem contorno. */
.chat-head .chip, #info-body .chip, .inbox-brief .chip { height: 22px; padding: 0 10px; gap: 5px; border-radius: 999px; box-shadow: none; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; }
.chat-head .chip.tag, #info-body .chip.tag { background: color-mix(in srgb, var(--c) 11%, transparent); color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.chat-head .chip.tag::before, #info-body .chip.tag::before { display: inline-block; content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chat-head .chip.tag .i, #info-body .chip.tag .i { width: 11px; height: 11px; opacity: .7; }
#info-body .chip.donor-chip { background: color-mix(in srgb, #d4af37 12%, transparent); color: #a8832a; }
.inbox-brief .chip.inbox-urgent { background: color-mix(in srgb, var(--t-ag-c) 11%, transparent); color: var(--t-ag-c); }
.inbox-brief .chip { background: var(--surface-2); color: var(--ink-2); }

/* ==========================================================================
   Acabamento leve (11/11): mesma altura para o que fica lado a lado, sem quebras,
   cores mantidas mas sem brilho/animação chamativa.
   ========================================================================== */
/* Topo da conversa: tudo com 30px e centralizado */
.chat-head { gap: 8px; }
.chat-head .icon-btn { width: 34px; height: 34px; }
.chat-head .agent-chip, .chat-head .chip, .chat-head #head-tag .chip { height: 30px; flex: none; }
.chat-head #head-tag { display: inline-flex; flex: none; }
.chat-head .chip { padding: 0 12px; font-size: 12.5px; }
.head-main .who { min-width: 0; }
.head-main .who strong, .head-main .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-chip { padding: 0 12px 0 10px; animation: none; box-shadow: none; border-width: 1px; background: linear-gradient(var(--ai-ink), var(--ai-ink)) padding-box, var(--ai-grad) border-box; }
.agent-chip:hover { box-shadow: none; filter: brightness(1.12); }
.orb { box-shadow: none; animation: none; }
.agent-chip.busy .orb, .agent-card.busy .orb { animation: orb 2.4s ease-in-out infinite; }

/* Cartão do agente: mesmo azul-escuro, sem borda girando e sombra mais leve */
.agent-card { box-shadow: 0 2px 10px rgba(13, 27, 42, .12); background: radial-gradient(110% 90% at 100% 0%, rgba(124, 58, 237, .22) 0, transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(6, 182, 212, .16) 0, transparent 60%), var(--ai-ink); }
.agent-card::before { animation: none; background: linear-gradient(120deg, rgba(124, 58, 237, .6), rgba(6, 182, 212, .5)); }
.ag-head { font-size: 10.5px; }
.ag-btn { height: 32px; box-shadow: none; border-radius: 8px; }

/* Avisos do agente no meio da conversa: sem brilho */
.ag-event { box-shadow: 0 1px 3px rgba(13, 27, 42, .14); }

/* Etapa no painel: três botões iguais; Café com campos da mesma altura */
.stage-opts { gap: 6px; }
.stage-opts button { height: 34px; font-size: 12px; border-radius: 8px; }
.stage-opts button.on { box-shadow: none; border-color: color-mix(in srgb, var(--c, var(--ai-1)) 60%, transparent); }
.stage-cafe .input, .stage-cafe select.input { height: 36px; }
.stage-cafe .btn { height: 36px; }

/* Chips do painel de dados: mesma altura, numa linha */
#info-body .chips { display: flex; flex-wrap: nowrap; gap: 6px; overflow: hidden; }
#info-body .chip { height: 24px; flex: none; }

/* Resumo: título e sinais na mesma linha base */
.inbox-brief summary { display: flex; align-items: center; gap: 8px; }
.inbox-brief-signals { gap: 8px; }
.inbox-brief .chip { height: 24px; }

/* ==========================================================================
   Padrão único do sistema (11/11). Uma régua para todas as páginas:
   alturas de controle 36px, cartões alinhados, etiquetas suaves em caixa normal,
   sem animação de entrada (trocar de página não "pisca"), mesma tipografia.
   ========================================================================== */
.view-in { animation: none; }

/* Controles: 36px em todo lugar (botões, campos, selects, abas segmentadas) */
.btn, .view .input:not(textarea), .view select.input, .view .seg a, .view .seg button, .settings-tabs a { height: 36px; }
.btn { padding: 0 14px; border-radius: 9px; font-size: 13px; }
.btn .i { width: 16px; height: 16px; }
.btn.sm, .btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.view .input:not(textarea), .view select.input { font-size: 13px; border-radius: 9px; }
.view textarea.input { border-radius: 9px; font-size: 13px; }
.view label > span, .view .field > label { font-size: 12px; }

/* Cartões lado a lado: mesma altura e mesmo topo (sem o deslocamento do 1º) */
:is(.kpis, .grid2, .fx-controls, .settings-grid, .agent-grid, .fx-gallery-grid) > * { margin-top: 0 !important; }
:is(.kpis, .grid2, .fx-controls, .settings-grid) { align-items: stretch; }
.kpis { margin: 16px 0; gap: 12px; }
.kpi { padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; min-height: 92px; }
.fx-controls { gap: 12px; }
.fx-controls > .card { min-height: 84px; }
/* Automações com a mesma largura das outras páginas */
.fx-home { max-width: 1200px; }

/* Etiquetas e selos: pílula suave, texto normal, mesma altura (estilo WhatsApp) */
.chip, .chip.tag, .chip.t-aguardando, .chip.t-pendente, .chip.t-agendado, .chip.t-aprovado, .pill, .badge, .me-role, .settings-status { text-transform: none; letter-spacing: 0; font-style: normal; }
.view .chip, .view .chip.tag, .view .chip.t-aguardando, .view .chip.t-pendente, .view .chip.t-agendado, .view .chip.t-aprovado { height: 22px; padding: 0 9px; gap: 5px; border-radius: 999px; font-size: 11.5px; font-weight: 500; box-shadow: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.view .chip { background: var(--surface-2); color: var(--ink-2); }
.view .chip.tag, .view .chip.t-aguardando, .view .chip.t-pendente, .view .chip.t-agendado, .view .chip.t-aprovado { background: color-mix(in srgb, var(--c) 11%, transparent); color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.view .chip.tag::before { display: inline-block; content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.view .chip .i { width: 11px; height: 11px; }
.pill { height: 24px; padding: 0 10px; font-size: 12px; font-weight: 500; }

/* Tabelas: cabeçalho discreto, linhas com respiro igual, ações lado a lado */
.view table th { font-size: 10.5px; letter-spacing: .05em; }
.view table td { vertical-align: middle; }
.team-actions { white-space: nowrap; }
.team-actions > form { display: inline-flex; margin: 0; }
.team-actions > *, .team-actions .icon-btn { display: inline-grid; vertical-align: middle; }
.team-actions .icon-btn { width: 32px; height: 32px; }

/* Cabeçalho das páginas: título, subtítulo e ações sempre no mesmo lugar */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; margin: 0; }
.view-head p { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
.view-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.settings-nav { margin-bottom: 18px; }

/* Agenda: etiqueta do café cabe no cartão */
.agenda-week .chip { max-width: 100%; }

/* Celular: barra inferior arrumada — itens com a mesma largura, rolagem lateral suave,
   Ajustes fica no menu da conta (bolinha com as iniciais), que vira um círculo pequeno. */
@media (max-width: 860px) {
    .rail-items { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; scroll-snap-type: x proximity; }
    .rail-items::-webkit-scrollbar { display: none; }
    .rail-items a { flex: 0 0 64px; min-width: 64px; scroll-snap-align: start; }
    .rail-items a span, .rail-foot button span { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
    .rail-foot { gap: 2px; align-items: center; padding-left: 4px; border-left: 1px solid rgba(255, 255, 255, .08); }
    .rail-foot .rail-config { display: none; }
    .rail-foot .push-bell { min-width: 52px; }
    .rail-foot .me-wrap { display: grid; place-items: center; width: 44px; }
    .rail-foot .me { display: grid; width: 32px; height: 32px; min-width: 0; padding: 0; border-radius: 50%; font-size: 11px; }
    .me-menu { left: auto; right: 0; bottom: 56px; }
}
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Funil no mesmo padrão: filtros com rótulo legível e controles de 36px, cartões de números iguais */
.crm-filters { padding: 14px 16px; gap: 12px; border-radius: 14px; }
.crm-filters label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.crm-filters .input { height: 36px; min-width: 150px; font-size: 13px; }
.crm-filters .board-search .input { min-width: 260px; }
.crm-filters .btn { height: 36px; }
.crm-overview .overview-feature { background: var(--surface); border-color: var(--line); }
.view-head .heading-actions { display: flex; gap: 8px; align-items: center; }
/* Configurações: grade de duas colunas (sem cartão sozinho na linha) */
@media (min-width: 900px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Funil: foto do WhatsApp no cartão e na ficha do candidato */
.crm-avatar { position: relative; overflow: hidden; }
.crm-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Funil enxuto (referência Pipedrive/HubSpot): resumo em uma linha, filtros numa barra,
   quadro ocupando a altura da tela e cartões compactos. Números detalhados ficam em Métricas.
   ========================================================================== */
.crm-view { background: var(--bg); }
.funnel-summary { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.funnel-summary span { white-space: nowrap; }
.funnel-summary b { color: var(--ink); font-weight: 600; }
.crm-filters { margin-bottom: 12px; padding: 10px 12px; align-items: center; }
.crm-filters label { display: flex; align-items: center; gap: 8px; }
.crm-filters label:not(.board-search) { font-size: 12px; }
.crm-filters .board-search { flex: 1 1 260px; font-size: 0; }
.crm-filters .board-search .input { flex: 1; min-width: 0; }
.crm-filters #board-status { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.board-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; padding: 0; border: 0; background: none; box-shadow: none; }

/* Quadro com a altura da tela */
@media (min-width: 861px) {
    .crm-view { display: flex; flex-direction: column; overflow: hidden; }
    .crm-view > .view-head, .crm-view > .crm-filters { flex: none; }
    .crm-board { flex: 1; min-height: 0; padding-bottom: 12px; }
    .crm-column { max-height: none; min-height: 0; height: 100%; }
}
.crm-board { gap: 10px; }
.crm-column { flex: 0 0 272px; border-radius: 12px; background: var(--surface-2); }
.crm-column > header { padding: 10px 12px 8px; }
.crm-column h3 { font-size: 13px; font-weight: 600; }
.crm-column > header small { margin: 2px 0 0 14px; font-size: 11.5px; color: var(--ink-3); }
.crm-cards { padding: 0 8px 8px; }
.column-empty { padding: 14px 8px; border: 0; font-size: 12px; color: var(--ink-3); }

/* Cartão compacto: foto, nome, UF · responsável, data */
.crm-card { padding: 8px 10px; margin-bottom: 6px; border-radius: 9px; box-shadow: 0 1px 1px rgba(15, 23, 42, .04); }
.crm-card:hover { border-color: color-mix(in srgb, var(--ink-3) 45%, var(--line)); box-shadow: 0 2px 6px rgba(15, 23, 42, .08); transform: none; }
.crm-card-identity { gap: 9px; }
.crm-card-identity .crm-avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
.crm-card-identity strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.crm-card-identity small { margin-top: 1px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.crm-card-identity time { flex: none; align-self: flex-start; font-size: 10.5px; color: var(--ink-3); }
.card-extra { display: flex; gap: 8px; align-items: center; margin: 6px 0 0 39px; font-size: 11.5px; }
.card-extra b { color: var(--t-ap-c, var(--brand-ink)); font-weight: 600; }
.card-extra .card-loss { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* No computador muda-se a etapa arrastando; a lista fica para toque */
@media (pointer: fine) { .crm-card .card-stage-select { display: none; } }
.crm-card .card-stage-select { margin-top: 8px; height: 30px; font-size: 12px; }
@media (min-width: 861px) { .crm-view { padding-bottom: 14px; } .crm-filters .btn { font-size: 13px; } }

/* Avisos do agente na conversa: discretos, como os avisos de sistema do WhatsApp */
.ag-event { gap: 6px; margin: 6px 0 2px; padding: 4px 10px 4px 7px; border-radius: 8px; border: 0; font-size: 12px; line-height: 1.35;
    color: var(--ink-2); background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 1px .5px rgba(11, 20, 26, .1); animation: none; }
.ag-event b { color: var(--ink); font-weight: 600; }
.ag-event time { font-size: 10.5px; color: var(--ink-3); }
.ag-event .ag-spark, .ag-event.manual .ag-spark { width: 16px; height: 16px; border-radius: 0; background: none; color: var(--ai-soft-ink); }
.ag-event .ag-spark .i { width: 13px; height: 13px; }
.ag-event.manual { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 0; box-shadow: 0 1px .5px rgba(11, 20, 26, .1); }
.ag-event.manual .ag-spark { color: var(--ink-3); }

/* ==========================================================================
   Agenda no padrão do funil: barra única, colunas na altura da tela, cartões compactos
   com foto (pensado para muitos cafés por dia).
   ========================================================================== */
.agenda-nav { padding: 10px 12px; gap: 8px; }
.agenda-nav .agenda-title { font-size: 14px; font-weight: 600; margin-inline-start: 6px; }
.agenda-filters { align-items: center; gap: 12px; }
.agenda-filters .field-l { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.agenda-filters .input { min-width: 140px; }
.agenda-week { gap: 10px; margin-top: 12px; }
.agenda-day { padding: 0; gap: 0; min-height: 0; background: var(--surface-2); border-radius: 12px; box-shadow: none; }
.agenda-day header { padding: 10px 12px 8px; border-bottom: 0; align-items: center; }
.agenda-day header span { font-size: 11px; letter-spacing: .04em; }
.agenda-day header b { font-size: 15px; font-weight: 600; }
.agenda-day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.agenda-day .day-cards, .agenda-day > .cafe-ev { margin: 0 8px 6px; }
.agenda-day p { margin: 2px 12px 12px; font-size: 12px; color: var(--ink-3); }
@media (min-width: 1101px) {
    .agenda { display: flex; flex-direction: column; height: 100%; }
    .view:has(> .agenda) { display: flex; flex-direction: column; padding-bottom: 14px; }
    .view:has(> .agenda) > .agenda { flex: 1; min-height: 0; width: 100%; }
    .agenda-week { flex: 1; min-height: 0; }
    .agenda-day { overflow-y: auto; padding-bottom: 4px; }
    .agenda-day header { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
}
/* Cartão do café */
.cafe-ev { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-inline-start: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 1px 1px rgba(15, 23, 42, .04); }
.cafe-ev:hover { background: var(--surface); border-color: color-mix(in srgb, var(--ink-3) 45%, var(--line)); box-shadow: 0 2px 6px rgba(15, 23, 42, .08); }
.cafe-ev .crm-avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
.cafe-ev-main { flex: 1; min-width: 0; display: grid; }
.cafe-ev-main b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.cafe-ev-main small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cafe-ev > time { flex: none; align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--ink); }
.cafe-ev-status { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-style: normal; font-size: 11px; font-weight: 500; color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.cafe-ev-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
/* Mês: uma linha por café (hora + nome), com a cor da etapa num ponto */
.cafe-ev.mini { gap: 5px; padding: 2px 6px; border: 0; border-radius: 5px; background: none; box-shadow: none; font-size: 12px; }
.cafe-ev.mini::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.cafe-ev.mini:hover { background: var(--row-hover); box-shadow: none; }
.cafe-ev.mini > time { align-self: auto; font-size: 11.5px; font-weight: 600; }
.cafe-ev.mini b { font-size: 12px; font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-undated .cafe-ev { display: grid; }
.cafe-ev .cafe-ev-main { display: grid; gap: 0; align-items: start; font-size: inherit; color: inherit; overflow: hidden; }
.cafe-ev .crm-avatar { display: inline-grid; }
.cafe-ev .cafe-ev-main small { display: block; }
.cafe-ev .cafe-ev-status { justify-self: start; }
.t-reagendar { --c: var(--t-ag-c); }
.chip.tag.t-reagendar, .cafe-ev.t-reagendar, .row-status.t-reagendar { background: var(--t-ag-bg); color: var(--t-ag); }
.cafe-ev.t-reagendar { border-inline-start: 3px solid var(--c); }
.cafe-ev.mini.t-reagendar { border-inline-start: 0; }
.cafe-ev .cafe-ev-missing { display: block; color: var(--t-pe); font-size: 11px; font-weight: 600; }
.cafe-ev.mini.has-missing { flex-wrap: wrap; }
.cafe-ev.mini .cafe-ev-missing { flex-basis: 100%; overflow-wrap: anywhere; }
.agenda-overdue { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; padding: 0 12px 12px; }
/* Semana com a largura toda (7 colunas), como o funil */
.view-in.agenda { max-width: none; }

.cafe-ev .crm-avatar { place-items: center; align-items: center; justify-items: center; gap: 0; font-size: 11px; color: hsl(var(--h) 50% var(--av-ink-l)); align-self: center; }
.cafe-ev .cafe-ev-main small time { font-size: inherit; font-weight: 600; color: var(--ink); }
.cafe-ev .cafe-ev-status { white-space: nowrap; }
.agenda-day > .cafe-ev { margin: 0 6px 6px; }

/* ==========================================================================
   Listas próprias em todo o sistema (ui.js): o campo parece um campo do Shark e a lista
   abre por cima de tudo, com busca nas listas longas e grade nas UFs.
   ========================================================================== */
.fsel { position: relative; display: block; width: 100%; min-width: 0; }
.fsel > select { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.fsel-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 400 13px var(--font); text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.fsel-btn:hover { border-color: color-mix(in srgb, var(--ink-3) 55%, var(--line)); }
.fsel-btn:disabled { opacity: .55; cursor: default; }
.fsel.open .fsel-btn { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.list-filters .fsel-btn { height: 32px; font-weight: 500; color: var(--ink-2); }
.list-filters .fsel.open .fsel-btn { box-shadow: none; border-color: var(--ink-3); }
/* Rótulo ao lado do campo (Funil, Agenda): o campo tem largura própria */
.crm-filters label:not(.board-search) .fsel, .agenda-filters .fsel { width: auto; min-width: 150px; }
.fsel-menu { position: fixed; z-index: 200; top: 0; left: 0; right: auto; max-width: 320px; max-height: min(360px, 60vh); display: flex; flex-direction: column; gap: 4px; overflow: hidden; padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(11, 20, 26, .18), 0 2px 6px rgba(11, 20, 26, .08); animation: fade .1s; }
.fsel-list { overflow-y: auto; display: grid; gap: 1px; }
.fsel-search { flex: none; height: 32px; margin: 2px 2px 2px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--ink); font: 400 13px var(--font); outline: 0; }
.fsel-search:focus { border-color: var(--brand); background: var(--surface); }
.fsel-opt[hidden] { display: none; }
.fsel-opt:disabled { opacity: .45; cursor: default; }
.fsel-menu.fsel-grid { max-width: none; }
.fsel-menu.fsel-grid .fsel-list { grid-template-columns: repeat(4, 44px); gap: 2px; }
.fsel-menu.fsel-grid .fsel-opt { justify-content: center; padding: 0; font-size: 12.5px; }
.fsel-menu.fsel-grid .fsel-opt.all { grid-column: 1 / -1; justify-content: flex-start; padding: 0 10px; }
.fsel-menu.fsel-grid .fsel-opt.on::after { display: none; }
.fsel-menu.fsel-grid .fsel-opt.on { background: var(--brand-soft); color: var(--brand-ink); }

/* Como usar */
.help { max-width: 860px; }
.help-index { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.help-index a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; text-decoration: none; }
.help-index a:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--brand-ink); }
.help-index a .i { color: var(--ink-3); }
.help-list { display: grid; gap: 8px; }
.help-topic { padding: 0; scroll-margin-top: 16px; }
.help-topic summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.help-topic summary::-webkit-details-marker { display: none; }
.help-topic summary::after { content: ""; margin-left: auto; flex: none; width: 8px; height: 8px; border: solid var(--ink-3); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); transition: transform .15s; }
.help-topic[open] summary::after { transform: rotate(-135deg); }
.help-topic summary > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.help-topic summary b { font-size: 14.5px; font-weight: 600; }
.help-topic summary small { font-size: 12.5px; color: var(--ink-3); }
.help-topic summary .chip { margin-left: auto; }
.help-topic summary .chip + * { margin-left: 0; }
.help-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.help-topic ol { margin: 0; padding: 0 20px 16px 64px; display: grid; gap: 8px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.help-topic ol b { color: var(--ink); font-weight: 600; }
.help-foot { margin: 18px 2px 0; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 600px) { .help-topic ol { padding-left: 34px; font-size: 15px; } }
.help-list > .card + .card { margin-top: 0; }

/* Produtos pagos no cartão do funil: principal discreto, upsells em destaque, Café com o Mestre com a cor do café */
.card-products { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0 39px; }
.card-products .cp { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.card-products .cp.g-extra, .card-products .cp.g-upsell { background: color-mix(in srgb, var(--t-ap-c, #16a34a) 12%, transparent); color: color-mix(in srgb, var(--t-ap-c, #16a34a) 80%, var(--ink)); }
.card-products .cp.g-cafe { background: color-mix(in srgb, #8b5cf6 14%, transparent); color: color-mix(in srgb, #8b5cf6 75%, var(--ink)); }
.card-products .cp.g-cafe::before { content: "☕"; font-size: 10px; }

/* ==========================================================================
   Contatos: lista com compras pagas e ficha lateral (como o perfil do Wolf)
   ========================================================================== */
.contacts { max-width: none; }
.ct-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; }
.ct-filters .ct-search { flex: 1 1 240px; width: auto; min-width: 200px; }
.ct-filters .fsel { width: auto; min-width: 150px; flex: 0 1 auto; }
.ct-filters > select.input { width: auto; min-width: 150px; }
.ct-list { padding: 0; overflow: hidden; }
.ct-list table { width: 100%; }
.ct-list tbody tr { cursor: pointer; transition: background .12s; }
.ct-list tbody tr:hover { background: var(--row-hover); }
.ct-list tbody tr.on { background: var(--row-sel); }
.ct-list td { padding-top: 9px; padding-bottom: 9px; }
.ct-who { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ct-who .crm-avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 11px; }
.ct-who > span:last-child { display: grid; min-width: 0; }
.ct-who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-who small { color: var(--ink-3); font-size: 12px; }
.ct-stage { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.ct-buys { display: flex; flex-wrap: wrap; gap: 4px; max-width: 340px; }
.ct-buy-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.ct-buy-chip b { color: var(--ink); font-weight: 600; }
.ct-pending { font-size: 12px; color: var(--t-pe-c, #b45309); }
.ct-more { font-size: 12px; color: var(--ink-3); align-self: center; }
.ct-pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }
.ct-pager span { margin-right: auto; }
.ct-sheet { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(440px, 100%); overflow-y: auto; padding: 18px 20px 28px; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, .14); animation: ct-in .18s ease-out; }
@media (min-width: 1024px) and (pointer: fine) { .ct-sheet { height: calc(100vh / var(--ui-zoom, 1)); } }
@keyframes ct-in { from { transform: translateX(24px); opacity: 0; } }
.ct-close { position: absolute; top: 12px; right: 12px; }
.ct-sheet-head { display: flex; gap: 14px; align-items: center; margin: 6px 36px 14px 0; }
.ct-sheet-head .crm-avatar.large { width: 56px; height: 56px; border-radius: 50%; font-size: 18px; }
.ct-sheet-head h2 { margin: 0; font-size: 19px; }
.ct-sheet-head p { margin: 2px 0 6px; color: var(--ink-3); font-size: 13px; }
.ct-sheet-head .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-open { width: 100%; margin-bottom: 8px; }
.ct-block { padding: 14px 0; border-top: 1px solid var(--line-2); }
.ct-block h3 { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.ct-block h3 small { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.ct-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.ct-facts .wide { grid-column: 1 / -1; }
.ct-facts dt { font-size: 11.5px; color: var(--ink-3); }
.ct-facts dd { margin: 1px 0 0; font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.ct-buy { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.ct-buy:last-child { border-bottom: 0; }
.ct-buy > div { flex: 1; display: grid; min-width: 0; }
.ct-buy b { font-size: 13.5px; font-weight: 600; }
.ct-buy small { font-size: 12px; color: var(--ink-3); }
.ct-amount { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.ct-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ct-timeline li { display: grid; grid-template-columns: 78px 1fr; gap: 10px; font-size: 13px; }
.ct-timeline time { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.ct-loading { padding: 20px 0; }
@media (max-width: 860px) { .ct-list th:nth-child(n+6), .ct-list td:nth-child(n+6) { display: none; } }

.ct-list th { text-align: left; white-space: nowrap; }
.ct-list th.num, .ct-list td.num { text-align: right; }
.ct-list th, .ct-list td { border-left: 0 !important; border-right: 0 !important; }
.ct-list td { border-bottom: 1px solid var(--line-2); }
.ct-list th, .ct-list td { padding-left: 14px; padding-right: 14px; }
.ct-list td:first-child, .ct-list th:first-child { padding-left: 16px; }
@media (max-width: 860px) {
    .ct-list .table-wrap { overflow: visible; }
    .ct-list table, .ct-list tbody { display: block; }
    .ct-list thead { display: none; }
    .ct-list tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
    .ct-list td { display: none; padding: 0 !important; border: 0 !important; }
    .ct-list td:nth-child(1) { display: block; }
    .ct-list td:nth-child(3) { display: block; align-self: center; text-align: right; }
    .ct-list td:nth-child(4) { display: block; grid-column: 1 / -1; padding-left: 42px !important; }
    .ct-list td:nth-child(4) .muted { display: none; }
    .ct-who { min-width: 0; }
}

/* Número sem WhatsApp: sinal claro em vermelho suave */
.nowa { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px; border-radius: 999px; font-style: normal; font-size: 11px; font-weight: 600; color: #dc2626; background: color-mix(in srgb, #ef4444 12%, transparent); white-space: nowrap; }
.nowa::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ef4444; }
.card-flags { margin: 6px 0 0 39px; }
.wa-ok { color: var(--brand-ink); font-size: 12px; }

/* Transferir para outra região */
.transfer-open { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--brand-ink); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.transfer-open:hover { text-decoration: underline; }
.transfer-form { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-3); }
.transfer-form .field-l { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.transfer-actions { display: flex; gap: 8px; }
.transfer-form small { font-size: 11.5px; }

/* Conversas: nome e prévia em primeiro plano. */
.row { min-height: 54px; padding-block: 6px; }
.row .avatar { width: 38px; height: 38px; }
.row .line1 strong { font-size: 13.5px; line-height: 1.25; font-weight: 500; }
.row .line2 { margin-top: 0; }
.row .line2 small { font-size: 12.5px; }
.row .line2 { gap: 6px; }
.row-preview-aside { display: flex; min-width: 0; max-width: 42%; align-items: center; gap: 5px; }
.row-preview-aside:empty { display: none; }
.row-preview-aside .count { flex: none; }
.row-status { display: table; margin-top: 4px; padding: 1px 5px; border-radius: 4px; font-size: 10px; line-height: 1.4; font-weight: 600; }
.row-routing { display: flex; min-width: 0; align-items: center; gap: 5px; color: var(--ink-3); font-size: 10.5px; white-space: nowrap; overflow: hidden; }
.row-region, .row-master { display: inline-flex; align-items: center; gap: 3px; }
.row-region, .row-routing .i { flex: none; }
.row-routing .i { width: 11px; height: 11px; }
.row-master { min-width: 0; }
.row-master > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-voice { display: inline-flex; flex: none; color: var(--wa-meta); }
.row-voice .i { width: 14px; height: 14px; }
.row-aside { display: inline-flex; flex: none; align-items: center; gap: 6px; }
.row-alert { display: inline-flex; color: var(--ink-3); }
.row-alert.urgent { color: var(--t-ag); }
.row-alert .i { width: 13px; height: 13px; }

/* Ajuda sempre à mão: botão flutuante no canto inferior direito */
.help-fab { position: fixed; z-index: 35; right: 20px; bottom: 20px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--brand-ink); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(11, 20, 26, .14); text-decoration: none; transition: transform .15s, box-shadow .2s, color .15s; }
.help-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(11, 20, 26, .2); color: var(--brand); }
.help-fab .i { width: 22px; height: 22px; }
body.inbox .help-fab { bottom: 84px; }
body.inbox:not(:has(.chat-head:not([hidden]))) .help-fab { bottom: 20px; }
@media (max-width: 860px) {
    .help-fab { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); width: 40px; height: 40px; }
    body.inbox .help-fab { bottom: calc(78px + env(safe-area-inset-bottom)); }
    .inbox.in-chat .help-fab, body:has(.in-chat) .help-fab { display: none; }
}
/* Conexão: caixa do webhook com o mesmo respiro dos lados também embaixo */
.webhook-box { margin: 0 16px 16px; padding: 14px 16px; border-style: solid; background: var(--surface-3); }
.webhook-box + .setup-steps { margin-top: 0; }

.install-steps { margin: 0; padding-inline-start: 22px; }
.install-steps li + li { margin-top: 6px; }

.ag-event-coffee-missing { display: block; color: var(--t-pe); font-weight: 600; }
.ag-coffee-missing { margin: 8px 0; padding: 6px 8px; border-radius: 6px; background: var(--t-pe-bg); color: var(--t-pe); }
.ag-coffee-missing p { margin: 0 0 4px; font-size: 12px; font-weight: 600; }
.ag-coffee-missing .ag-btn { color: inherit; }

.coffee-overdue-column > header h3 { color: var(--t-ag); }

/* Lista (refino): prévia sozinha na 2ª linha; etapa, UF e mestre juntos na 3ª, sem cortes */
.row .line2 { display: flex; align-items: center; gap: 6px; }
.row .line2 small { flex: 1; min-width: 0; }
.row .line2 .count { flex: none; }
.row-meta3 { display: flex !important; align-items: center; gap: 8px; min-width: 0; margin-top: 3px; overflow: hidden; white-space: nowrap; font-size: 11.5px; color: var(--ink-3); }
.row-meta3 .row-status { display: inline-flex; flex: none; align-items: center; height: 18px; margin: 0; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--c, var(--ink-3)) 12%, transparent); color: color-mix(in srgb, var(--c, var(--ink-3)) 80%, var(--ink)); }
.row-meta3 .row-region { flex: none; display: inline-flex; align-items: center; gap: 3px; }
.row-meta3 .row-master { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.row-meta3 .row-master span { overflow: hidden; text-overflow: ellipsis; }
.row-meta3 .i { width: 11px; height: 11px; flex: none; }

/* Encerrar à mão */
.close-pick { margin-top: 12px; }
.close-pick .label { display: flex; gap: 6px; align-items: baseline; }
.close-now { font-weight: 500; color: var(--t-ag); text-transform: none; letter-spacing: 0; }
.close-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.close-opts button { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.close-opts button:hover { border-color: color-mix(in srgb, var(--t-ag-c) 45%, var(--line)); color: var(--ink); }
.close-opts button.on { border-color: color-mix(in srgb, var(--t-ag-c) 60%, transparent); background: color-mix(in srgb, var(--t-ag-c) 10%, var(--surface)); color: var(--t-ag); }
.reopen { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--brand-ink); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.row-status.t-encerrado { --c: var(--ink-3); }

/* ==========================================================================
   Celular com cara de app de WhatsApp (11/11): 4 abas + "Mais", folha que sobe
   de baixo, lista grande e legível (mestres 40+), filtros em chips.
   ========================================================================== */
.rail-more, .more-sheet { display: none; }
.fsel-sheet { position: fixed; inset: 0; z-index: 300; }
@media (max-width: 860px) {
    html.sheet-open, html.sheet-open body { overflow: hidden; }

    /* Barra de abas: clara, 5 itens iguais, ícone com pílula verde quando ativo */
    .rail { background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(11, 20, 26, .05); }
    .rail-foot { display: none !important; }
    .rail-items { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible !important; gap: 0; width: 100%; }
    .rail-items:not(:has(.m-agenda)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .rail-items a.m-more { display: none !important; }
    .rail-items .m-conversas { order: 1; } .rail-items .m-funil { order: 2; } .rail-items .m-agenda { order: 3; } .rail-items .m-contatos { order: 4; } .rail-items .rail-more { order: 5; }
    .rail-items a, .rail-items .rail-more, .rail-items .brand-home, .rail-items .brand-home.on { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; height: 56px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none !important; box-shadow: none !important; color: var(--ink-2); font: 500 11.5px var(--font); position: relative; }
    .rail-items a .i, .rail-items .rail-more .i { box-sizing: content-box; width: 22px; height: 22px; padding: 4px 18px; border-radius: 999px; transition: background .15s; }
    .rail-items a.on, .rail-items .rail-more.on { color: var(--brand-ink); font-weight: 700; }
    .rail-items a.on .i, .rail-items .rail-more.on .i { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand-ink); }
    .rail-items a span, .rail-items .rail-more span { display: block !important; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
    .rail-badge { top: 2px !important; right: calc(50% - 26px) !important; }
    .help-fab { display: none !important; }

    /* Folha "Mais" */
    .more-sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 250; }
    .ms-backdrop, .fs-backdrop { position: absolute; inset: 0; background: rgba(11, 20, 26, .45); animation: fade .15s; }
    .ms-panel, .fs-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow-y: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--surface); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
    @keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
    .ms-grip, .fs-grip { display: block; width: 40px; height: 4px; margin: 2px auto 12px; border-radius: 4px; background: var(--line); }
    .ms-me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line-2); }
    .ms-me .me-av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: hsl(var(--h) 40% 28%); color: hsl(var(--h) 80% 90%); }
    .ms-me b { display: block; font-size: 16px; } .ms-me small { color: var(--ink-3); font-size: 13px; }
    .ms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
    .ms-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; border-radius: 14px; background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; text-align: center; }
    .ms-grid a.on { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-ink); }
    .ms-ico { position: relative; display: grid; place-items: center; color: var(--brand-ink); }
    .ms-ico .dot { position: absolute; top: -2px; right: -4px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface-2); }
    .ms-ico .dot.on { background: #22c55e; } .ms-ico .dot.off { background: #ef4444; }
    .ms-list { display: grid; padding-top: 6px; }
    .ms-list button, .ms-list a { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 6px; border: 0; background: none; color: var(--ink); font: 500 15.5px var(--font); text-decoration: none; text-align: left; }
    .ms-list .i { color: var(--ink-3); }
    .ms-list .ms-out { color: #dc2626; } .ms-list .ms-out .i { color: #dc2626; }

    /* Folha dos filtros */
    .fs-title { margin: 0 4px 8px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
    .fs-list { display: grid; }
    .fs-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 8px; border: 0; border-bottom: 1px solid var(--line-2); background: none; color: var(--ink); font: 400 16px var(--font); text-align: left; }
    .fs-opt[hidden] { display: none; }
    .fs-opt b { font-size: 13px; font-weight: 600; color: var(--ink-3); }
    .fs-opt.on { color: var(--brand-ink); font-weight: 600; }
    .fs-opt.on::after { content: ""; width: 12px; height: 7px; border: solid var(--brand); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translateY(-2px); }
    .fs-list.grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .fs-list.grid .fs-opt { justify-content: center; min-height: 46px; border: 0; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
    .fs-list.grid .fs-opt.all { grid-column: 1 / -1; justify-content: flex-start; background: none; }
    .fs-list.grid .fs-opt.on { background: color-mix(in srgb, var(--brand) 16%, transparent); }
    .fs-list.grid .fs-opt.on::after { display: none; }
    .fs-panel .fsel-search { width: 100%; height: 44px; margin-bottom: 8px; font-size: 16px; }

    /* Conversas: cabeçalho e filtros como no app */
    .pane-head { padding: 14px 16px 6px; }
    .pane-head h1 { font-size: 26px; }
    .search { height: 42px; border-radius: 21px; font-size: 16px; }
    .list-filters { display: flex !important; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; border-bottom: 0; }
    .list-filters::-webkit-scrollbar { display: none; }
    .list-filters .fsel { flex: none; width: auto; }
    .list-filters .fsel-btn { height: 34px; padding: 0 12px 0 14px; border-radius: 999px; background: var(--surface-2); border-color: transparent; font-size: 14px; font-weight: 500; color: var(--ink-2); }
    .list-filters .fsel.set .fsel-btn { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-ink); }
    .list-filters .owner-tabs { display: flex; gap: 8px; flex: none; }
    .list-filters .owner-tabs label > span { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 999px; }

    /* Linhas grandes e legíveis */
    .row { margin: 0; padding: 10px 16px; gap: 14px; border-radius: 0; }
    .row .avatar { width: 52px; height: 52px; font-size: 17px; }
    .row .line1 strong { font-size: 16.5px; font-weight: 600; }
    .row .line1 time { font-size: 12.5px; }
    .row .line2 small { font-size: 15px; }
    .row .line2 .count { min-width: 22px; height: 22px; font-size: 12.5px; }
    .row-meta3 { font-size: 12.5px; }
    .row .mid { padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
    .row.on { background: none; }

    /* Conversa aberta */
    .chat-head { height: 60px; padding: 0 6px; gap: 6px; }
    .chat-head #agent-chip, .chat-head #head-channel { display: none !important; }
    .head-main .avatar { width: 40px; height: 40px; }
    .head-main .who strong { font-size: 16.5px; }
    .chat-head #head-tag .chip { height: 26px; padding: 0 10px; font-size: 12px; }
    .msg .txt, .bubble .txt { font-size: 15.5px; line-height: 1.45; }
    .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
    .composer textarea { font-size: 16px; }

    /* Filtros das outras telas em chips também */
    .crm-filters .fsel, .agenda-filters .fsel, .ct-filters .fsel { min-width: 0; }
    .crm-filters .fsel-btn, .agenda-filters .fsel-btn, .ct-filters .fsel-btn { height: 40px; border-radius: 999px; font-size: 15px; }
}
@media (max-width: 860px) {
    .composer .send { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--brand) !important; color: #fff !important; box-shadow: 0 2px 6px rgba(139, 92, 246, .3); }
    .composer .send .i { width: 21px; height: 21px; }
}
.close-pick { padding-top: 10px; border-top: 1px dashed var(--line-2); }
.close-pick .label { display: flex !important; margin: 0 0 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }

/* ==========================================================================
   Modelos de mensagem (templates da API oficial)
   ========================================================================== */
.templates .view-head .actions form { display: inline; }
.tp-reject { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--t-ag-bg); color: var(--t-ag); font-size: 12.5px; }
.link.danger { border: 0; background: none; padding: 0; color: #dc2626; font-size: 12.5px; font-weight: 600; cursor: pointer; }
/* Prévia estilo WhatsApp */
.tp-phone { padding: 14px; border-radius: 12px; background: var(--wa-bg); background-image: radial-gradient(var(--wa-dots) 1px, transparent 1px); background-size: 18px 18px; }
.tp-bubble { max-width: 100%; padding: 8px 10px 6px; border-radius: 0 10px 10px 10px; background: var(--wa-in); box-shadow: var(--bubble-shadow); color: var(--ink); font-size: 13.5px; line-height: 1.45; }
.tp-bubble p { margin: 0; overflow-wrap: anywhere; }
.tp-bubble mark { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--brand) 20%, transparent); color: inherit; }
.tp-head { display: block; margin-bottom: 4px; font-size: 14px; }
.tp-foot { display: block; margin-top: 6px; color: var(--ink-3); font-size: 12px; }
.tp-buttons { display: grid; gap: 4px; margin-top: 4px; }
.tp-buttons span { display: block; padding: 8px; border-radius: 8px; background: var(--wa-in); box-shadow: var(--bubble-shadow); color: #0a84c7; font-size: 13.5px; font-weight: 500; text-align: center; }
/* Formulário */
/* Modelos da API oficial */
.tp-manager { overflow: hidden; }
.tp-toolbar { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(110px, 1fr)); gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.tp-table-scroll { overflow-x: auto; }
.tp-table { width: 100%; min-width: 650px; border-collapse: collapse; text-align: left; font-size: 13px; }
.tp-table th { background: var(--surface-2); font-size: 12px; color: var(--ink-2); font-weight: 600; }
.tp-table th, .tp-table td { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.tp-table tbody tr:hover { background: var(--row-hover); }
.tp-table td:first-child { width: 44%; }
.tp-table td small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 4px; color: var(--ink-3); }
.tp-name { font-weight: 650; overflow-wrap: anywhere; text-align: left; }
.tp-result-count { margin: 0; padding: 12px 16px; font-size: 12px; }
.tp-library { margin-top: 16px; }
.tp-library details { padding: 10px 16px; border-top: 1px solid var(--line); }
.tp-library summary { cursor: pointer; }
.tp-library summary span { margin-inline-start: 10px; color: var(--ink-3); font-size: 12px; }
.tp-library .tp-phone { margin-block: 12px; max-width: 430px; }
.tp-details { width: min(530px, 95vw); }
.tp-details > .icon-btn { float: right; }
.tp-details h2 { overflow-wrap: anywhere; }
.tp-details form { margin-top: 12px; }
.tp-dialog { width: min(960px, 96vw); }
.tp-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 20px; padding: 4px 0 12px; }
.tp-fields, .tp-examples, #tp-button-list { display: grid; gap: 10px; }
.tp-fields fieldset { display: grid; min-width: 0; gap: 9px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.tp-category-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tp-category-choice { display: flex; align-items: start; gap: 5px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tp-category-choice:has(:checked) { border-color: var(--brand); background: var(--brand-soft); }
.tp-category-choice input { accent-color: var(--brand); margin: 2px 0 0; }
.tp-category-choice strong, .tp-category-choice small { display: block; overflow-wrap: anywhere; }
.tp-category-choice strong { font-size: 12px; }
.tp-category-choice small { margin-top: 4px; color: var(--ink-2); font-size: 11px; }
#tp-card-list, #tp-otp-app-list, #tp-otp-apps { display: grid; gap: 8px; }
.tp-preview-card { min-width: 150px; flex: 1; padding: 8px; border-radius: 8px; background: var(--wa-in); font-size: 12px; }
.tp-preview-cards { display: flex; gap: 6px; overflow: auto; margin-top: 8px; }
@media (max-width: 450px) { .tp-category-options { grid-template-columns: 1fr; } }
.tp-fields legend { padding-inline: 5px; color: var(--ink); font-weight: 650; }
.tp-toolbar .field-l, .tp-fields .field-l { display: grid; gap: 5px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.tp-fields [hidden] { display: none; }
.tp-fields textarea { width: 100%; resize: vertical; }
.tp-inline { display: flex; justify-content: space-between; }
.tp-button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.tp-button-row [data-remove] { grid-column: 1 / -1; justify-self: end; }
.tp-live { position: sticky; top: 0; align-self: start; display: grid; gap: 8px; }
.tp-live .label { margin: 0; color: var(--ink-3); font-size: 12px; font-weight: 650; }
.tp-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
    .tp-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-form-grid { grid-template-columns: 1fr; }
    .tp-live { position: static; }
}

.window-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.window-note span { flex: 1 1 260px; }
.window-note .btn { flex: none; }
.tpl-send { width: min(460px, 96vw); }
#tpl-body { display: grid; gap: 10px; padding: 4px 0 12px; }
#tpl-body .field-l { display: grid; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }

/* ===== Mensagens no padrão do WhatsApp Web (áudio, documento, foto) ===== */
.msg { font-size: 14.2px; line-height: 19px; padding: 6px 7px 8px 9px; border-radius: 7.5px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.msg .meta { font-size: 11px; line-height: 15px; margin: 8px 0 -6px 10px; }
.msg .txt:empty { display: none; }

/* Áudio: tocar · onda com bolinha · foto com microfone (vira 1x tocando) */
.msg.is-audio { padding: 7px 8px 6px 6px; }
.wa-audio { display: grid; grid-template-columns: 34px minmax(0, 1fr) 46px; align-items: center; gap: 0 8px; width: 262px; max-width: 100%; padding: 0; }
.wa-play { width: 34px; height: 34px; color: color-mix(in srgb, var(--ink) 62%, transparent); margin-top: -14px; }
.wa-audio .wa-play svg { width: 26px; height: 26px; }
.wa-track { display: grid; gap: 4px; padding-top: 10px; }
.wa-wave { position: relative; display: flex; align-items: center; gap: 2px; height: 22px; }
.wa-wave i { flex: 1; min-width: 2px; max-width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--wa-meta) 45%, transparent); }
.wa-wave i.on, .wa-audio.in .wa-wave i.on { background: color-mix(in srgb, var(--wa-meta) 95%, transparent); }
.wa-knob { position: absolute; top: 50%; left: calc(var(--p, 0) * (100% - 12px)); width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #53bdeb; pointer-events: none; transition: left .12s linear; }
.wa-audio.out .wa-knob { background: var(--brand); }
.wa-audio.heard .wa-knob { background: #53bdeb; }
.wa-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; line-height: 15px; color: var(--wa-meta); }
.wa-info .meta { float: none; margin: 0; }
.wa-face { position: relative; width: 46px; height: 46px; display: grid; place-items: center; }
.wa-face > .avatar { width: 46px; height: 46px; font-size: 15px; }
.wa-audio .wa-face .wa-audio-mic, .wa-audio.out .wa-face .wa-audio-mic { position: absolute; left: -4px; bottom: -1px; width: 19px; height: 19px; border-radius: 0; background: none; color: var(--brand); filter: drop-shadow(0 0 1px var(--wa-in)) drop-shadow(0 0 1px var(--wa-in)); }
.wa-audio.out .wa-face .wa-audio-mic { background: none; color: #53bdeb; filter: drop-shadow(0 0 1px var(--wa-out)) drop-shadow(0 0 1px var(--wa-out)); }
.wa-audio.heard .wa-face .wa-audio-mic { color: #53bdeb; }
.wa-face .wa-audio-mic svg { width: 19px; height: 19px; }
.wa-face .wa-speed { display: none; min-width: 38px; height: 26px; padding: 0 8px; border-radius: 13px; background: color-mix(in srgb, var(--wa-meta) 40%, transparent); color: #fff; font: 600 13px var(--font); }
.wa-audio.playing .wa-face > .avatar, .wa-audio.playing .wa-audio-mic { display: none; }
.wa-audio.playing .wa-speed { display: block; }
.msg.has-media .wa-audio + .audio-transcript, .msg .audio-transcript { margin: 6px 4px 0 42px; }
.msg.is-audio:not(.solo) .txt { padding: 4px 2px 0; }

/* Documento: cartão com ícone do tipo, nome e baixar */
.msg.is-document { padding: 3px 3px 8px; }
.msg.is-document > em { padding: 3px 6px 2px; }
.doc { display: flex; align-items: center; gap: 10px; width: 290px; max-width: 100%; min-width: 0; padding: 10px 12px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); text-decoration: none; }
.msg.out .doc { background: color-mix(in srgb, #025144 7%, transparent); }
.doc:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.doc-ic { position: relative; flex: none; width: 26px; height: 32px; color: #8696a0; }
.doc-ic.pdf { color: #e2504a; }
.doc-ic svg { width: 26px; height: 32px; display: block; }
.doc-ic b { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font: 700 7px var(--font); color: #fff; letter-spacing: .02em; }
.doc-name { flex: 1; min-width: 0; display: grid; }
.doc-name b { font-weight: 400; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-name small { font-size: 12px; color: var(--wa-meta); }
.doc-dl { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--wa-meta) 45%, transparent); color: var(--wa-meta); }
.doc-dl .i { width: 17px; height: 17px; color: currentColor; }
.msg.is-document .txt { padding: 0 6px; }

/* Foto e vídeo: hora por cima da imagem quando não há legenda */
.msg.is-image, .msg.is-video { padding: 3px; }
.msg.is-image > em, .msg.is-video > em { padding: 3px 6px 3px; }
.msg.is-image .txt, .msg.is-video .txt { padding: 4px 6px 0; }
.wa-pic { position: relative; display: block; border-radius: 6px; overflow: hidden; }
.wa-pic img, .wa-pic video { display: block; max-width: min(330px, 100%); max-height: 340px; border-radius: 6px; }
.wa-pic.broken { width: 240px; height: 160px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.wa-pic.broken img { display: none; }
.wa-pic .meta { position: absolute; right: 0; bottom: 0; float: none; margin: 0; padding: 14px 7px 4px 24px; border-radius: 0 0 6px 0; background: radial-gradient(ellipse at 100% 100%, rgba(11, 20, 26, .5), transparent 70%); color: #fff; }
.wa-pic .meta .tick, .wa-pic .tk:not(.read) .tick { color: #fff; }

@media (max-width: 860px) {
    .wa-audio { width: 250px; }
    .doc { width: 260px; }
}

/* ===== Painel do contato: nada cortado nem espremido ===== */
.kv { gap: 12px 14px; }
.kv .wide { grid-column: 1 / -1; }
.kv dt { font-size: 11px; margin-bottom: 2px; }
.kv dd { font-size: 13px; line-height: 1.35; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.stage-opts button, .close-opts button { height: auto; min-height: 36px; padding: 7px 10px; line-height: 1.25; white-space: normal; overflow: visible; text-overflow: clip; text-align: center; }
.close-opts { gap: 8px; }
.steps-l, .journey.compact .steps-l { align-items: start; font-size: 11px; line-height: 1.3; }
.steps-l span { overflow-wrap: break-word; }
.ag-line { line-height: 1.4; }
@media (max-width: 860px) {
    .kv dt { font-size: 12px; }
    .kv dd { font-size: 14.5px; }
    .stage-opts button, .close-opts button { min-height: 42px; font-size: 13.5px; }
    .steps-l, .journey.compact .steps-l { font-size: 12px; }
}

/* ===== Agenda: cartão em linhas curtas, sem cortar texto ===== */
.agenda-day .cafe-ev, .agenda-overdue .cafe-ev { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 3px; padding: 10px 11px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 1px 1px rgba(15, 23, 42, .04); }
.agenda-day .cafe-ev + .cafe-ev { margin-top: 0; }
.agenda-day > .cafe-ev { margin: 0 8px 8px; }
.cafe-ev-top { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 3px; }
.cafe-ev-top .crm-avatar { flex: none; width: 28px; height: 28px; font-size: 11px; }
.cafe-ev-top b { min-width: 0; font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.cafe-ev-when time { font-size: 13px; font-weight: 700; color: var(--ink); }
.cafe-ev-place { font-size: 12px; line-height: 1.35; color: var(--ink-2); overflow-wrap: anywhere; }
.cafe-ev-who { font-size: 11.5px; line-height: 1.3; color: var(--ink-3); overflow-wrap: anywhere; }
.cafe-ev > .cafe-ev-status { justify-self: start; margin-top: 4px; padding: 2px 8px 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--c) 12%, transparent); color: color-mix(in srgb, var(--c) 80%, var(--ink)); font-size: 11px; font-weight: 600; white-space: nowrap; }
.cafe-ev > .cafe-ev-missing { margin-top: 2px; line-height: 1.3; }
/* Reagendar: cartão branco como os outros, só a borda e a etiqueta avisam */
.agenda-day .cafe-ev.t-reagendar, .agenda-overdue .cafe-ev.t-reagendar { background: var(--surface); color: var(--ink); border-color: var(--line); border-inline-start: 3px solid var(--c); }
.agenda-day .cafe-ev.t-reagendar .cafe-ev-top b, .agenda-overdue .cafe-ev.t-reagendar .cafe-ev-top b { color: var(--ink); }
.agenda-overdue { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; padding: 12px 14px 14px; }
.agenda-overdue .cafe-ev-when time { color: var(--t-ag); }
@media (max-width: 860px) {
    .cafe-ev-top b { font-size: 15px; }
    .cafe-ev-when time { font-size: 14.5px; }
    .cafe-ev-place { font-size: 13.5px; }
    .cafe-ev-who { font-size: 12.5px; }
}
.cafe-ev.t-reagendar { --c: var(--t-ag-c); }

/* ===== Assistente de dúvidas (canto da tela) ===== */
.help-fab { display: none !important; }
.helpbot { position: fixed; z-index: 60; right: 20px; bottom: 20px; }
.hb-fab { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 16px 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 13.5px var(--font); box-shadow: 0 6px 20px rgba(11, 20, 26, .14); cursor: pointer; transition: transform .15s, box-shadow .2s; }
.hb-fab .i { width: 19px; height: 19px; color: var(--ai-1, #7c3aed); }
.hb-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(11, 20, 26, .2); }
.helpbot.open .hb-fab { display: none; }
body.inbox .helpbot { bottom: 84px; }
body.inbox:not(:has(.chat-head:not([hidden]))) .helpbot { bottom: 20px; }
body.inbox .hb-fab { width: 42px; padding: 0; justify-content: center; }
body.inbox .hb-fab span { display: none; }
.hb-panel { position: fixed; right: 20px; bottom: 20px; width: min(380px, calc(100vw - 32px)); height: min(580px, calc(100vh - 40px)); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 18px 50px rgba(11, 20, 26, .22); overflow: hidden; animation: fade .18s; }
.hb-panel[hidden] { display: none; }
.hb-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--line-2); }
.hb-head > div { flex: 1; min-width: 0; display: grid; }
.hb-head b { font-size: 14px; }
.hb-head small { font-size: 11.5px; color: var(--ink-3); }
.hb-orb { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7c3aed, #0ea5a4); }
.hb-orb .i { width: 16px; height: 16px; }
.hb-icon { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: var(--ink-3); cursor: pointer; }
.hb-icon:hover { background: var(--hover); color: var(--ink); }
.hb-msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--wa-bg); }
.hb-msg { max-width: 88%; padding: 8px 11px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.hb-msg p { margin: 0; overflow-wrap: anywhere; }
.hb-msg.a { align-self: flex-start; background: var(--wa-in); color: var(--ink); border-top-left-radius: 3px; }
.hb-msg.u { align-self: flex-end; background: var(--wa-out); color: var(--ink); border-top-right-radius: 3px; }
.hb-msg.err p { color: var(--t-ag); }
.hb-go { display: inline-flex; margin-top: 8px; padding: 6px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.hb-go:hover { filter: brightness(.96); }
.hb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-chips button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 500 12.5px var(--font); text-align: left; cursor: pointer; }
.hb-chips button:hover { border-color: var(--brand); color: var(--ink); }
.hb-typing p { display: flex; gap: 4px; padding: 4px 2px; }
.hb-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: hbDot 1s infinite; }
.hb-typing i:nth-child(2) { animation-delay: .15s; }
.hb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hbDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.hb-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 6px; border-top: 1px solid var(--line-2); }
.hb-form textarea { flex: 1; min-height: 40px; max-height: 110px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); color: var(--ink); font: 14px/1.35 var(--font); resize: none; outline: none; }
.hb-form textarea:focus { border-color: var(--brand); background: var(--surface); }
.hb-form button { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; cursor: pointer; }
.hb-guide { padding: 2px 14px 10px; font-size: 11.5px; color: var(--ink-3); text-align: center; }
@media (max-width: 860px) {
    .helpbot, body.inbox .helpbot { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); }
    .hb-fab { height: 40px; }
    body:has(.in-chat) .hb-fab { display: none; }
    .hb-panel { inset: 0; right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
    .hb-msg { font-size: 15.5px; }
    .hb-chips button { font-size: 14px; padding: 9px 13px; }
    .hb-form { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
    .hb-form textarea { font-size: 16px; }
    html.hb-open { overflow: hidden; }
}
/* Na conversa aberta o botão flutuante cobriria o painel do contato: lá a ajuda fica no menu lateral (Dúvidas). */
body.inbox:has(.chat-head:not([hidden])) .hb-fab { display: none; }
.rail-foot .rail-help .i { color: #c4b5fd; }
@media (max-width: 860px) { .rail-foot .rail-help { display: none; } }
/* Agenda: nome alinhado à foto; no mês, o nome quebra em vez de cortar */
.cafe-ev-top > b { align-self: center; margin: 0; }
.cafe-ev.mini { align-items: flex-start; }
.cafe-ev.mini b { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.3; }
.cafe-ev.mini::before { margin-top: 5px; }

/* ===== Assistente com a cara da tela de entrada (vidro verde-escuro, borda viva, verde do Shark) ===== */
@property --hb-ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.hb-fab { height: 46px; padding: 0 18px 0 8px; gap: 9px; border: 0; color: #F1F4FF; background: linear-gradient(160deg, #1E1B4B, #0F0B2E); box-shadow: 0 12px 30px rgba(5, 6, 20, .35), inset 0 1px 0 rgba(255, 255, 255, .1); }
.hb-fab .i { width: 30px; height: 30px; padding: 5px; border-radius: 50%; color: #fff; background: var(--brand-grad); box-shadow: 0 0 14px rgba(139, 92, 246, .45); }
.hb-fab:hover { box-shadow: 0 16px 34px rgba(5, 6, 20, .45), 0 0 0 3px rgba(139, 92, 246, .18); }
body.inbox .hb-fab { width: 46px; padding: 0; }
.rail-foot .rail-help .i { color: #9cc3ff; }

.hb-panel { border: 0; border-radius: 20px; color: #F1F4FF; background: linear-gradient(160deg, rgba(20, 44, 35, .97), rgba(8, 22, 17, .98)); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08); overflow: visible; }
.hb-panel::before { content: ""; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit; background: conic-gradient(from var(--hb-ang), rgba(255, 255, 255, .07) 0deg, #3A78F2 60deg, #22d3ee 110deg, #a78bfa 160deg, rgba(255, 255, 255, .07) 220deg, rgba(255, 255, 255, .07) 360deg); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: hb-spin 6s linear infinite; pointer-events: none; }
@keyframes hb-spin { to { --hb-ang: 360deg; } }
.hb-panel > * { position: relative; }
.hb-head { padding: 14px 10px 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.hb-head b { color: #fff; font-size: 14.5px; }
.hb-head small { color: rgba(220, 255, 236, .62); }
.hb-orb { width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--brand-grad); box-shadow: 0 6px 18px rgba(139, 92, 246, .35); }
.hb-orb .i { width: 22px; height: 22px; }
.hb-icon { color: rgba(220, 255, 236, .6); }
.hb-icon:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.hb-msgs { background: none; padding: 16px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.hb-msg { box-shadow: none; border-radius: 14px; }
.hb-msg.a { background: rgba(255, 255, 255, .07); color: #F1F4FF; border: 1px solid rgba(255, 255, 255, .06); border-top-left-radius: 4px; }
.hb-msg.a b { color: #fff; }
.hb-msg.u { background: var(--brand-grad); color: #fff; font-weight: 500; border-top-right-radius: 4px; }
.hb-msg.err p { color: #fda4af; }
.hb-go { background: rgba(139, 92, 246, .16); color: #9cc3ff; border: 1px solid rgba(139, 92, 246, .3); }
.hb-chips button { border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); color: rgba(232, 255, 243, .85); }
.hb-chips button:hover { border-color: #3A78F2; color: #fff; background: rgba(139, 92, 246, .1); }
.hb-typing i { background: #9cc3ff; }
.hb-form { border-top: 1px solid rgba(255, 255, 255, .08); padding: 12px 12px 6px; }
.hb-form textarea { overflow-y: hidden; scrollbar-width: none; border-color: rgba(255, 255, 255, .14); background: rgba(8, 9, 11, .6); color: #F1F4FF; }
.hb-form textarea::-webkit-scrollbar { display: none; }
.hb-form textarea::placeholder { color: rgba(220, 255, 236, .45); }
.hb-form textarea:focus { border-color: #3A78F2; background: rgba(8, 9, 11, .85); box-shadow: 0 0 0 4px rgba(139, 92, 246, .16); }
.hb-form button { color: #fff; background: var(--brand-grad); box-shadow: 0 8px 20px rgba(139, 92, 246, .3); }
.hb-form button:hover { filter: brightness(1.05); }
.hb-guide { color: rgba(220, 255, 236, .5); }
.hb-guide:hover { color: #9cc3ff; }
@media (max-width: 860px) { .hb-panel { border-radius: 0; } .hb-panel::before { display: none; } }
@media (prefers-reduced-motion: reduce) { .hb-panel::before { animation: none; } }
.hb-typing small { display: block; margin-top: 4px; font-size: 12px; color: rgba(220, 255, 236, .6); }
/* "Dúvidas?" com texto em todas as telas. Em Conversas fica no canto de baixo da lista, longe do painel do contato e do campo de mensagem. */
body.inbox .hb-fab, body.inbox:has(.chat-head:not([hidden])) .hb-fab { display: inline-flex; width: auto; padding: 0 18px 0 8px; }
body.inbox .hb-fab span { display: inline; }
body.inbox .helpbot, body.inbox:not(:has(.chat-head:not([hidden]))) .helpbot { right: auto; left: 72px; bottom: 16px; }
body.inbox .hb-panel { right: auto; left: 72px; bottom: 16px; }
@media (max-width: 860px) {
    body.inbox .helpbot, body.inbox:not(:has(.chat-head:not([hidden]))) .helpbot { left: auto; right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); }
    body:has(.in-chat) .hb-fab { display: none; }
}
@media (max-width: 860px) { body.inbox .hb-panel { left: 0; right: 0; bottom: 0; } }

/* ===== "Dúvidas": botão pequeno e sempre no mesmo lugar (canto inferior direito) ===== */
.helpbot, body.inbox .helpbot, body.inbox:not(:has(.chat-head:not([hidden]))) .helpbot { left: auto; right: 18px; bottom: 18px; }
.hb-fab, body.inbox .hb-fab, body.inbox:has(.chat-head:not([hidden])) .hb-fab { display: inline-flex; width: auto; height: 34px; padding: 0 12px 0 4px; gap: 6px; font-size: 12.5px; font-weight: 600; box-shadow: 0 4px 14px rgba(5, 6, 20, .22), inset 0 1px 0 rgba(255, 255, 255, .08); }
.hb-fab .i { width: 26px; height: 26px; padding: 4px; box-shadow: none; }
.hb-fab:hover { transform: none; box-shadow: 0 6px 18px rgba(5, 6, 20, .3), 0 0 0 3px rgba(139, 92, 246, .15); }
.helpbot.open .hb-fab { display: none; }
.hb-panel, body.inbox .hb-panel { left: auto; right: 18px; bottom: 18px; }
/* Conversas: o painel do contato e o campo de mensagem deixam espaço para o botão. */
body.inbox.show-info #info { padding-bottom: 60px; }
body.inbox:not(.show-info) .composer { padding-right: 120px; }
@media (max-width: 860px) {
    .helpbot, body.inbox .helpbot, body.inbox:not(:has(.chat-head:not([hidden]))) .helpbot { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); }
    body:has(.in-chat) .hb-fab { display: none; }
    body.inbox:not(.show-info) .composer { padding-right: 12px; }
    .hb-panel, body.inbox .hb-panel { left: 0; right: 0; bottom: 0; }
}
/* Assistente menorzinho, estilo Messenger */
.hb-panel, body.inbox .hb-panel { width: min(330px, calc(100vw - 32px)); height: min(460px, calc(100vh - 40px)); border-radius: 16px; }
.hb-head { padding: 10px 6px 10px 12px; gap: 8px; }
.hb-orb { width: 30px; height: 30px; border-radius: 10px; }
.hb-orb .i { width: 18px; height: 18px; }
.hb-head b { font-size: 13.5px; }
.hb-head small { font-size: 11px; }
.hb-icon { width: 30px; height: 30px; }
.hb-msgs { padding: 12px; gap: 6px; }
.hb-msg { font-size: 13px; padding: 7px 10px; }
.hb-chips button { font-size: 12px; padding: 6px 10px; }
.hb-form { padding: 8px 8px 4px; }
.hb-form textarea { min-height: 36px; padding: 8px 12px; font-size: 13.5px; }
.hb-form button { width: 36px; height: 36px; }
.hb-guide { padding: 2px 12px 8px; font-size: 11px; }
.hb-fab { position: relative; }
.hb-dot { position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: #ff3b5c; box-shadow: 0 0 0 2px var(--surface); }
.hb-dot[hidden] { display: none; }
@media (max-width: 860px) {
    .hb-panel, body.inbox .hb-panel { width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
    .hb-msg { font-size: 15px; }
    .hb-form textarea { font-size: 16px; }
}
/* Assistente: fonte menor para caber mais na janela (desktop) */
@media (min-width: 861px) {
    .hb-msg { font-size: 12px; line-height: 1.4; padding: 6px 9px; }
    .hb-chips button { font-size: 11.5px; padding: 5px 9px; }
    .hb-go { font-size: 11.5px; padding: 4px 9px; margin-top: 6px; }
    .hb-head b { font-size: 13px; }
    .hb-head small { font-size: 10.5px; }
    .hb-form textarea { font-size: 12.5px; min-height: 34px; padding: 8px 12px; }
    .hb-typing small { font-size: 11px; }
}

/* ===== Menu da conta: alinhado, tag ao lado do nome, sem repetir Configurações ===== */
.me-menu { width: 260px; padding: 6px; gap: 0; }
.me-head { gap: 10px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); }
.me-head .me-av { flex: none; width: 38px; height: 38px; }
.me-id { min-width: 0; display: grid; gap: 1px; }
.me-id b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; min-width: 0; }
.me-id small { max-width: none; }
.me-id .me-role { margin: 0; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--brand-ink); background: var(--brand-soft); box-shadow: none; }
.me-menu button, .me-menu a, .rail-foot .me-menu button, .rail-foot .me-menu a { height: 38px; padding: 0 10px; gap: 12px; border-radius: 8px; }
.me-menu .i, .me-menu i { flex: none; width: 18px; height: 18px; display: inline-grid; place-items: center; }
.me-menu i .i { width: 18px; height: 18px; }
.me-sep { margin: 4px 6px; border: 0; border-top: 1px solid var(--line-2); }
.me-menu .me-out { border-top: 0; margin-top: 0; border-radius: 8px; }

/* ===== Instalar o app ===== */
.inst-app { width: 44px; height: 44px; border-radius: 11px; flex: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.inst-app-fb { display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--brand-grad); }
.inst-dialog { width: min(400px, calc(100% - 24px)); border-radius: 18px; }
.inst-box { gap: 14px; padding: 16px 18px 20px; }
.inst-plat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.inst-hero { display: flex; align-items: center; gap: 14px; }
.inst-hero .inst-app { width: 56px; height: 56px; border-radius: 14px; }
.inst-hero h2 { margin: 0 0 2px; font-size: 18px; }
.inst-hero p { color: var(--ink-2); font-size: 13.5px; }
.inst-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.inst-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.inst-steps li > span:last-child { display: grid; gap: 1px; min-width: 0; }
.inst-steps li b { font-weight: 500; font-size: 14px; }
.inst-steps li b b { font-weight: 700; }
.inst-steps small { font-size: 12px; color: var(--ink-3); }
.inst-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--brand); }
.inst-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.inst-ic .inst-app { width: 30px; height: 30px; border-radius: 8px; box-shadow: none; }
.inst-dots { font-size: 20px; line-height: 1; }
.inst-tip { font-size: 12.5px; color: var(--ink-3); }
.inst-banner { position: fixed; z-index: 55; left: 10px; right: 10px; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 10px; border-radius: 16px; background: linear-gradient(160deg, #1E1B4B, #0F0B2E); color: #F1F4FF; box-shadow: 0 14px 34px rgba(5, 6, 20, .35); animation: shk-rise .25s ease-out; }
.inst-banner[hidden] { display: none; }
.inst-banner .inst-app { width: 40px; height: 40px; }
.inst-banner-t { flex: 1; min-width: 0; display: grid; }
.inst-banner-t b { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: #fff; }
.inst-banner-t small { font-size: 12px; color: rgba(220, 255, 236, .7); }
.inst-banner-t svg { width: 15px; height: 15px; color: #fff; }
.inst-go { flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; font: 700 13.5px var(--font); color: #fff; background: var(--brand-grad); cursor: pointer; }
.inst-x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: rgba(220, 255, 236, .6); font-size: 14px; cursor: pointer; }
body:has(.inst-banner:not([hidden])) .helpbot { bottom: calc(140px + env(safe-area-inset-bottom)); }
html.hb-open .inst-banner, body:has(.in-chat) .inst-banner { display: none; }
.inst-dialog .icon-btn:focus { outline: none; box-shadow: none; border-color: transparent; }

/* ===== Históricos fechados: abrem só quando alguém quer ver ===== */
details.fold > summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2, details.fold > summary h3, details.fold > summary .label { margin: 0; }
details.fold > summary small { color: var(--ink-3); }
.fold-hint { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--brand-ink); background: var(--brand-soft); }
.fold-hint::after { content: ""; width: 6px; height: 6px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
details.fold[open] > summary .fold-hint { font-size: 0; gap: 0; padding: 3px 8px; }
details.fold[open] > summary .fold-hint::before { content: "Ocultar"; font-size: 12px; margin-right: 4px; }
details.fold[open] > summary .fold-hint::after { transform: rotate(-135deg) translateY(-1px); }
details.fold:not([open]) > summary { padding-bottom: 0; }
details.card.fold > summary.card-head { border-bottom: 0; }
details.card.fold[open] > summary.card-head { border-bottom: 1px solid var(--line-2); }
.crm-timeline.fold > summary { margin-bottom: 8px; }

/* Ficha do contato: telefone formatado e selo de WhatsApp */
.ct-phone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wa-pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); }
.wa-pill.ok { color: #0a7a52; background: rgba(34, 211, 238, .14); }
.wa-pill.no { color: var(--t-ag); background: var(--t-ag-bg); }
:root[data-theme="dark"] .wa-pill.ok { color: #9cc3ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-pill.ok { color: #9cc3ff; } }
/* Menu da conta: itens centralizados na vertical e com a mesma largura no hover */
.me-menu button, .me-menu a, .rail-foot .me-menu button, .rail-foot .me-menu a { box-sizing: border-box; width: 100%; margin: 0; align-items: center; line-height: 1; }
details.fold > summary::after { display: none !important; }
details.fold > summary h3, details.fold > summary h2 { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: flex-start; gap: 8px; }
.ct-block.fold > summary h3 small { margin-left: 0; }
.fold-hint { text-transform: none; letter-spacing: 0; }
.ct-block.fold > summary { padding: 2px 0; }
.ct-block.fold[open] > summary { margin-bottom: 10px; }
details.fold[open] > summary .fold-hint::before { margin-right: 6px; }

/* ===== Aviso de instalar no topo, no estilo da faixa de app do Safari ===== */
.inst-banner { position: fixed; z-index: 80; top: 0; left: 0; right: 0; bottom: auto; height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0 6px; gap: 10px; border-radius: 0; color: var(--ink); background: color-mix(in srgb, var(--surface-2) 92%, var(--surface)); border-bottom: 1px solid var(--line); box-shadow: none; backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); animation: inst-down .3s ease-out; }
@keyframes inst-down { from { transform: translateY(-100%); } }
.inst-banner .inst-x { order: -1; width: 26px; height: 26px; color: var(--ink-3); font-size: 13px; }
.inst-banner .inst-app { width: 42px; height: 42px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.inst-banner-t b { color: var(--ink); font-size: 14.5px; font-weight: 600; }
.inst-banner-t small { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst-banner-t small svg { flex: none; width: 12px; height: 12px; color: var(--ink-3); }
.inst-banner .inst-go { height: 30px; padding: 0 16px; font-size: 13.5px; }
/* Empurra o painel para baixo da faixa, como o Safari faz. */
html.has-inst-banner body.app { height: calc(100dvh - 64px - env(safe-area-inset-top)); margin-top: calc(64px + env(safe-area-inset-top)); }
html.has-inst-banner .helpbot, body:has(.inst-banner:not([hidden])) .helpbot { bottom: 18px; }
@media (max-width: 860px) { html.has-inst-banner .helpbot, body:has(.inst-banner:not([hidden])) .helpbot { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ===== Celular: filtros como faixa de chips (igual ao WhatsApp), em todas as telas ===== */
@media (max-width: 860px) {
    .ct-filters, .crm-filters, .agenda-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0; border: 0; background: none; box-shadow: none; }
    .card.ct-filters { padding: 0; background: none; border: 0; box-shadow: none; }
    .ct-filters .ct-search, .crm-filters input[type="search"], .crm-filters > input { width: 100%; height: 42px; border-radius: 21px; padding: 0 16px; font-size: 15px; }
    .fchips { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .fchips::-webkit-scrollbar { display: none; }
    .fchips > label, .fchips > .fsel { flex: none; display: block; margin: 0; padding: 0; font-size: 0; gap: 0; }
    .fchips .fsel { width: auto; min-width: 0; }
    .fchips .fsel-btn { width: auto; height: 34px; padding: 0 12px 0 14px; gap: 6px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink-2); font: 500 14px var(--font); box-shadow: none; white-space: nowrap; }
    .fchips .fsel-btn span { max-width: 160px; }
    .fchips .fsel.set .fsel-btn { border-color: transparent; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
    .agenda-nav { display: grid; gap: 10px; }
}

/* Contatos: sem preço na lista; só um sinal pequeno de compra (os detalhes ficam na ficha) */
.ct-sig { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ct-sig::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ct-sig.paid { color: #0a8a5c; }
.ct-sig.pend { color: var(--t-pe, #b45309); }
:root[data-theme="dark"] .ct-sig.paid { color: #9cc3ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ct-sig.paid { color: #9cc3ff; } }
@media (max-width: 860px) {
    .ct-list tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 2px 10px; }
    .ct-list td:nth-child(1) { grid-row: 1 / 3; grid-column: 1; }
    .ct-list td:nth-child(3) { grid-row: 1; grid-column: 2; align-self: end; }
    .ct-list td:nth-child(4) { grid-row: 2; grid-column: 2; padding-left: 0 !important; text-align: right; align-self: start; }
    .ct-list td:nth-child(4) .muted { display: none; }
}
@media (max-width: 860px) {
    .fchips > label, .fchips > label.field-l { display: block !important; font-size: 0 !important; line-height: 0; gap: 0 !important; margin: 0 !important; color: transparent; }
    .fchips > label .fsel-btn { line-height: 1.2; }
    .agenda-nav .btn { height: 38px; }
    .agenda-nav { grid-template-columns: repeat(3, auto) 1fr; align-items: center; }
    .agenda-nav .agenda-title { grid-column: 1 / -1; order: -1; }
    .agenda-nav .agenda-filters { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    .fchips > label, .fchips > label.field-l, .fchips > .fsel { flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
    .fchips .fsel { display: block; }
}
@media (max-width: 860px) {
    .crm-filters { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    .crm-filters .board-search { grid-column: 1; margin: 0; }
    .crm-filters #board-refresh { grid-column: 2; width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 0; gap: 0; justify-content: center; }
    .crm-filters #board-refresh .i { width: 18px; height: 18px; }
    .crm-filters #board-status, .crm-filters .board-live { display: none; }
    .crm-filters .fchips { grid-column: 1 / -1; }
}
@media (max-width: 860px) { .fchips label .fsel, .fchips .fsel { min-width: 0 !important; width: auto !important; } }

/* ===================== Celular: padrão de app (Apple/Google/Meta) =====================
   Cabeçalho compacto, sem barra de rolagem lateral, cartões e números mais baixos,
   filtros recolhidos e nada quebrando em duas linhas sem necessidade. */
.mfold-btn { display: none; }
@media (max-width: 860px) {
    html, body, .view, .crm-board, .crm-cards, .hb-msgs, .fs-list { scrollbar-width: none; }
    html::-webkit-scrollbar, body::-webkit-scrollbar, .view::-webkit-scrollbar, .crm-board::-webkit-scrollbar, .crm-cards::-webkit-scrollbar { display: none; }
    .view { padding: 12px 14px calc(16px + env(safe-area-inset-bottom)) !important; }
    .view-in { max-width: none; }

    /* Cabeçalho: título grande compacto, subtítulo em uma linha, ações como ícones */
    .view-head { flex-wrap: nowrap; align-items: center; gap: 10px; margin-bottom: 12px; }
    .view-head > div:first-child { min-width: 0; flex: 1; }
    .view-head h1 { font-size: 24px; line-height: 1.15; letter-spacing: -.02em; margin: 0; }
    .view-head p { margin-top: 2px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .view-head .actions, .view-head .heading-actions { flex: none; display: flex; gap: 6px; }
    .heading-actions .btn { width: 38px; height: 38px; padding: 0; border-radius: 50%; justify-content: center; }
    .heading-actions .btn span { display: none; }
    .heading-actions .btn .i { width: 18px; height: 18px; margin: 0; }
    .settings-nav { margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
    .settings-nav .settings-crumb { display: none; }
    .settings-tabs a { white-space: nowrap; }

    /* Cartões e títulos de cartão */
    .card-head { flex-wrap: wrap; gap: 2px 10px; padding: 12px 14px; }
    .card-head h2 { font-size: 15px; }
    .card-head small { flex-basis: 100%; order: 2; font-size: 12px; }
    details.card.fold > summary.card-head { flex-wrap: nowrap; }
    details.card.fold > summary.card-head small { display: none; }

    /* Números (KPIs): 2 por linha, baixos */
    .kpis { grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
    .kpi { padding: 10px 12px; }
    .kpi small { font-size: 10px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
    .kpi b { font-size: 20px; margin: 2px 0 0; }
    .kpi span { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* Filtros recolhidos num botão (Métricas, Modelos…) */
    .mfold-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; margin: 0 0 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); font: 600 14px var(--font); cursor: pointer; }
    .mfold-btn b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 11px; color: #fff; background: var(--brand); }
    .mfold-btn .mf-chev { transition: transform .15s; }
    .mfold-btn.on { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
    .mfold-btn.on .mf-chev { transform: rotate(180deg); }
    [data-mobile-fold][data-folded]:not(.mfold-open) { display: none !important; }
    [data-mobile-fold].mfold-open { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px !important; margin-bottom: 12px; }
    [data-mobile-fold].mfold-open .btn { grid-column: auto; }
    [data-mobile-fold].mfold-open label:has(input[type="search"]) { grid-column: 1 / -1; }

    /* Funil: resumo em uma linha, colunas largas, cartão em linhas curtas sem quebrar */
    .funnel-summary { display: flex; gap: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
    .funnel-summary span { flex: none; }
    .crm-board { gap: 10px; scroll-snap-type: x mandatory; scroll-padding: 0 14px; }
    .crm-column { flex: 0 0 84vw !important; width: 84vw !important; max-width: 340px; scroll-snap-align: start; }
    .crm-card-identity strong, .crm-card-identity small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .card-products { display: flex; flex-wrap: nowrap; gap: 4px; overflow: hidden; mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
    .card-products .cp { flex: none; white-space: nowrap; }

    /* Agenda: navegação numa linha (‹ Hoje ›) e período ao lado */
    .agenda-nav { display: grid !important; grid-template-columns: auto auto auto minmax(0, 1fr); align-items: center; gap: 6px 6px; padding: 10px 12px !important; }
    .agenda-nav > .btn { height: 34px; padding: 0 10px; font-size: 13px; }
    .agenda-nav > .btn:first-child, .agenda-nav > .btn:nth-child(3) { width: 34px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
    .agenda-nav > .btn:first-child .i, .agenda-nav > .btn:nth-child(3) .i { width: 16px; height: 16px; }
    .agenda-nav .agenda-title { order: 0; grid-column: auto; justify-self: end; font-size: 13.5px; white-space: nowrap; }
    .agenda-nav .agenda-filters { grid-column: 1 / -1; }
    .agenda > .card .card-head small { display: none; }
}
@media (max-width: 860px) {
    .view-head.funnel-head { display: flex !important; grid-template-columns: none !important; }
    .view-head > div:first-child { flex: 1 1 auto !important; min-width: 0 !important; width: auto !important; }
    .view-head:has(> .actions) { flex-wrap: wrap; }
    .view-head > .actions { width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
    .view-head > .actions .btn { height: 34px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
    .view-head > .actions .seg a, .view-head > .actions .seg button { height: 30px; padding: 0 12px; font-size: 13px; }
}
@media (max-width: 860px) { .view-head .heading-actions { width: auto !important; flex: none !important; } .heading-actions .btn { font-size: 0 !important; } }
html.has-inst-banner { overflow: hidden; height: 100%; }
@media (max-width: 860px) {
    .ct-filters .ct-search { border-radius: 21px; background: var(--surface-2); border-color: transparent; }
}

/* ===== Janelas: barra de arrastar, X no topo, fechar tocando fora ===== */
.sheet-grip { display: none; }
.sheet-x { position: absolute; z-index: 3; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); cursor: pointer; }
.sheet-x:hover { color: var(--ink); background: var(--hover); }
dialog.crm-dialog, dialog.drawer { position: fixed; }
dialog.crm-dialog { padding-top: 28px; }
#contact-dialog > .btn[data-close] { display: none; }
@media (max-width: 860px) {
    dialog.crm-dialog, dialog.drawer, dialog.push-dialog { position: fixed; inset: auto 0 0 0; margin: 0; width: 100% !important; max-width: 100% !important; height: auto; max-height: 92dvh; border: 0; border-radius: 18px 18px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); overflow: auto; overscroll-behavior: contain; touch-action: pan-y; }
    dialog.crm-dialog[open], dialog.drawer[open], dialog.push-dialog[open] { animation: sheet-up .25s ease-out; }
    dialog.drawer { display: none; flex-direction: column; }
    dialog.drawer[open] { display: flex; }
    .ct-sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92dvh; border: 0; border-radius: 18px 18px 0 0; padding-top: 26px; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); animation: sheet-up .25s ease-out; }
    .sheet-grip { display: block; position: sticky; top: 0; z-index: 2; width: 100%; height: 22px; margin: -18px 0 4px; cursor: grab; touch-action: none; }
    .sheet-grip::after { content: ""; display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: color-mix(in srgb, var(--ink-3) 45%, transparent); }
    dialog.drawer .sheet-grip { margin: 0; position: absolute; top: 0; left: 0; }
    .sheet-x { top: 14px; right: 14px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ===== Busca: um padrão só (o das Conversas) em todas as telas ===== */
.ct-filters .ct-search, .crm-filters .board-search input, #tp-search { height: 38px; padding: 0 12px; border: 0 !important; border-radius: 10px !important; background: var(--surface-2); font-size: 14px; box-shadow: none; }
.ct-filters .ct-search:focus, .crm-filters .board-search input:focus, #tp-search:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--brand); outline: 0; }
@media (max-width: 860px) {
    .search, .inbox .search { height: 40px; border-radius: 10px !important; margin-left: 14px; margin-right: 14px; }
    .ct-filters .ct-search, .crm-filters input[type="search"], .crm-filters > input, .crm-filters .board-search input { height: 40px; border-radius: 10px !important; padding: 0 12px; font-size: 15px; }
    .crm-filters #board-refresh { width: 40px; height: 40px; border-radius: 10px; }
    /* Faixas que rolam de lado: nunca mostram barra */
    .fchips, .ct-filters, .crm-filters, .agenda-filters, .view-head > .actions, .settings-nav, .funnel-summary, .tp-toolbar { scrollbar-width: none; }
    .fchips::-webkit-scrollbar, .ct-filters::-webkit-scrollbar, .crm-filters::-webkit-scrollbar, .agenda-filters::-webkit-scrollbar, .view-head > .actions::-webkit-scrollbar, .settings-nav::-webkit-scrollbar, .funnel-summary::-webkit-scrollbar, .tp-toolbar::-webkit-scrollbar { display: none; height: 0; }
    .ct-filters { overflow: visible; }

    /* Filtros abertos (Métricas, Relatórios, Modelos): campo com o nome dentro, como no Google */
    [data-mobile-fold].mfold-open { gap: 8px !important; padding: 10px !important; }
    [data-mobile-fold].mfold-open label.field-l { display: grid; gap: 0; padding: 6px 10px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); min-width: 0; }
    [data-mobile-fold].mfold-open label.field-l:focus-within { border-color: var(--brand); }
    [data-mobile-fold].mfold-open label.field-l .input { height: 26px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 14.5px; font-weight: 500; color: var(--ink); width: 100%; }
    [data-mobile-fold].mfold-open label.field-l .fsel-btn { height: 26px; padding: 0; border: 0; background: none; font-size: 14.5px; }
    [data-mobile-fold].mfold-open > .btn { height: 38px; justify-content: center; }
}
.sheet-x:focus:not(:focus-visible), dialog .icon-btn:focus:not(:focus-visible) { outline: none; box-shadow: none; }
@media (max-width: 860px) { .crm-filters .board-search { margin: 0 !important; padding: 0 !important; font-size: 0; } .crm-filters .board-search input { width: 100%; } }

/* Atalho "Marcar café" no topo da conversa: um toque abre direto o formulário do café */
.cafe-quick { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--t-ca-bg); color: var(--t-ca); font: 600 12.5px var(--font); cursor: pointer; white-space: nowrap; transition: filter .15s; }
.cafe-quick:hover { filter: brightness(.96); }
.cafe-quick .i { width: 16px; height: 16px; }
@media (max-width: 1100px) { .cafe-quick span { display: none; } .cafe-quick { width: 34px; padding: 0; justify-content: center; } }

/* ==========================================================================
   Identidade 2026 · v2 (12/11/2026): esmeralda, noite, dourado e papel; logo de balão mantido;
   fonte do sistema (SF no Apple, Roboto no Android, Segoe no Windows); brilho e movimento sutis.
   A IA continua azul/roxa. Movimento desliga sozinho para quem pede "reduzir movimento".
   ========================================================================== */
:root {
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Google Sans Text", "Google Sans", Roboto, "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Google Sans Display", "Google Sans", Roboto, "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
    --emerald: #7C3AED; --emerald-2: #8B5CF6; --emerald-3: #22D3EE; --night: #07081A; --gold: #B8913A; --gold-2: #E2C26F; --mint: #A5F3FC;
    /* Claro: base neutra de antes, no padrão Meta e Google (cinza frio, branco, sombra leve) */
    --bg: #F0F2F5; --surface: #FFFFFF; --surface-2: #F0F2F5; --surface-3: #F7F8FA; --hover: #F2F4F6;
    --line: #E4E6EB; --line-2: #EDEFF2; --ink: #1C1E21; --ink-2: #5F6368; --ink-3: #80868B;
    --brand: #0A8F6A; --brand-ink: #077A5A; --brand-soft: #E6F4EE; --on-brand: #FFFFFF;
    --rail: #07081A; --rail-ink: #8FA69C;
    --wa-bg: #EFEAE2; --wa-out: #D9FDD3; --wa-author: var(--brand-ink); --tick: #53BDEB;
    --glow: 0 1px 3px rgba(60, 64, 67, .22), 0 4px 10px 2px rgba(10, 143, 106, .16);
    --brand-grad: linear-gradient(135deg, #14B583 0%, #0A8F6A 100%);
    --sheen: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 48%, transparent 66%);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --shadow-sm: 0 1px 2px rgba(60, 64, 67, .1);
    --shadow: 0 1px 2px rgba(60, 64, 67, .12), 0 2px 6px 2px rgba(60, 64, 67, .07);
}
:root[data-theme="dark"] {
    --bg: #070F0C; --surface: #0E1714; --surface-2: #16211D; --surface-3: #111B18; --hover: #18241F;
    --line: #1F2D28; --line-2: #18241F; --ink: #E7EEEA; --ink-2: #A9B7B0; --ink-3: #74867E;
    --brand: #8B5CF6; --brand-ink: #3DD3A4; --brand-soft: rgba(31, 169, 130, .15); --on-brand: #04130E;
    --rail: #050C0A; --rail-ink: #7E968C;
    --wa-bg: #070F0C; --wa-in: #16211D; --wa-out: #0C4F3D; --wa-author: #5FE0B6; --composer: #0E1714; --composer-field: #16211D;
    --glow: 0 0 0 1px rgba(34, 211, 238, .28), 0 0 28px -4px rgba(34, 211, 238, .45); --brand-grad: linear-gradient(135deg, #22D3EE 0%, #7C3AED 55%, #4C1D95 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -12px rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #070F0C; --surface: #0E1714; --surface-2: #16211D; --surface-3: #111B18; --hover: #18241F;
        --line: #1F2D28; --line-2: #18241F; --ink: #E7EEEA; --ink-2: #A9B7B0; --ink-3: #74867E;
        --brand: #8B5CF6; --brand-ink: #3DD3A4; --brand-soft: rgba(31, 169, 130, .15); --on-brand: #04130E;
        --rail: #050C0A; --rail-ink: #7E968C;
        --wa-bg: #070F0C; --wa-in: #16211D; --wa-out: #0C4F3D; --wa-author: #5FE0B6; --composer: #0E1714; --composer-field: #16211D;
        --glow: 0 0 0 1px rgba(34, 211, 238, .28), 0 0 28px -4px rgba(34, 211, 238, .45); --brand-grad: linear-gradient(135deg, #22D3EE 0%, #7C3AED 55%, #4C1D95 100%);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -12px rgba(0, 0, 0, .6);
    }
}

/* Tipografia do sistema, com os ajustes de espaçamento que Apple e Google usam */
body { font-family: var(--font); font-feature-settings: normal; letter-spacing: -.003em; }
h1, h2, h3, .view-head h1, .pane-head h1, .card-head h2, .crm-dialog h2, .kpi b { font-family: var(--font-display); letter-spacing: -.022em; font-weight: 700; }

/* Movimento */
@keyframes shk-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shk-sheen { from { background-position: -160% 0; } to { background-position: 260% 0; } }
@keyframes shk-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0), 0 8px 22px -6px rgba(139, 92, 246, .55); } 50% { box-shadow: 0 0 0 5px rgba(34, 211, 238, .12), 0 8px 26px -4px rgba(31, 169, 130, .7); } }
@keyframes shk-aurora { 0% { transform: translate3d(0, 0, 0) scale(1); } 100% { transform: translate3d(6%, 5%, 0) scale(1.15); } }

/* Menu lateral: noite com brilho esmeralda, item ativo aceso e marcador dourado */
.rail { background: radial-gradient(120% 40% at 50% 0%, rgba(31, 169, 130, .22), transparent 70%), linear-gradient(180deg, #0C1F19, var(--rail) 40%); border-right: 1px solid rgba(127, 224, 185, .07); }
.rail-items .brand-home, .rail-items .brand-home.on { position: relative; overflow: hidden; color: #fff; background: var(--brand-grad); animation: shk-breathe 4.5s ease-in-out infinite; }
.rail-items .brand-home::after, .logo::after, .ld-mark::after, .auth-card .logo::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--sheen); background-size: 250% 100%; animation: shk-sheen 5s var(--ease-out) infinite; pointer-events: none; }
.logo, .ld-mark, .auth-card .logo { position: relative; overflow: hidden; background: var(--brand-grad) !important; box-shadow: 0 8px 22px -6px rgba(139, 92, 246, .6), inset 0 1px 0 rgba(255, 255, 255, .22); }
.rail-items a:hover, .rail-foot a:hover, .rail-foot button:hover { background: rgba(127, 224, 185, .08); color: #fff; }
.rail-items a.on:not(.brand-home) { background: linear-gradient(180deg, rgba(34, 211, 238, .2), rgba(31, 169, 130, .1)); color: var(--mint); box-shadow: inset 0 0 0 1px rgba(127, 224, 185, .22), 0 0 18px -4px rgba(34, 211, 238, .5); }
.rail-items a.on:not(.brand-home)::before { background: var(--gold-2); box-shadow: 0 0 10px rgba(226, 194, 111, .8); }
.rail-items a .i, .rail-foot a .i, .rail-foot button .i { transition: transform .25s var(--ease-out); }
.rail-items a:hover .i { transform: scale(1.08); }
.rail-foot .push-bell.on, .rail-foot .rail-config.on { color: var(--mint); }
button.me:hover, button.me[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--rail), 0 0 0 4px var(--emerald-2), 0 0 16px rgba(34, 211, 238, .5); }
.rail [data-label]:hover::after { background: var(--night); border: 1px solid rgba(127, 224, 185, .15); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }

/* Botões: gradiente esmeralda, luz por cima e brilho ao passar o mouse */
.btn:not(.ghost):not(.secondary):not(.danger):not(.light) { position: relative; overflow: hidden; background: var(--brand-grad); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 16px -8px rgba(139, 92, 246, .7); transition: box-shadow .2s, transform .12s, filter .2s; }
.btn:not(.ghost):not(.secondary):not(.danger):not(.light)::after { content: ""; position: absolute; inset: 0; background: var(--sheen); background-size: 250% 100%; background-position: -160% 0; pointer-events: none; }
.btn:not(.ghost):not(.secondary):not(.danger):not(.light):hover { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--glow); }
.btn:not(.ghost):not(.secondary):not(.danger):not(.light):hover::after { animation: shk-sheen .9s var(--ease-out); }
.btn:active { transform: scale(.97); }
.count { background: var(--brand-grad); box-shadow: 0 0 10px -1px rgba(34, 211, 238, .6); }
.composer .send { background: var(--brand-grad) !important; box-shadow: 0 4px 14px -4px rgba(139, 92, 246, .7), inset 0 1px 0 rgba(255, 255, 255, .2); }
.send { transition: transform .15s var(--ease-out), box-shadow .2s; }
.send:hover { transform: scale(1.06); box-shadow: var(--glow); }
.wa-audio.out .wa-knob { background: var(--emerald); }
.wa-audio .wa-face .wa-audio-mic, .wa-audio.out .wa-face .wa-audio-mic { color: var(--emerald-2); }

/* Campos: anel de foco luminoso */
.input:focus, .search:focus-within { border-color: var(--emerald-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald-2) 20%, transparent), 0 0 18px -6px color-mix(in srgb, var(--emerald-2) 60%, transparent); }

/* Superfícies: entram subindo de leve e acendem ao passar o mouse */
.card, .kpi, .crm-card, .cafe-ev, .flow-card, .settings-card, .reply-card, .provider-card { animation: shk-rise .45s var(--ease-out) both; transition: box-shadow .25s, border-color .25s, transform .25s var(--ease-out); }
.kpis > :nth-child(2), .crm-cards > :nth-child(2) { animation-delay: .04s; }
.kpis > :nth-child(3), .crm-cards > :nth-child(3) { animation-delay: .08s; }
.kpis > :nth-child(4), .crm-cards > :nth-child(4) { animation-delay: .12s; }
.kpis > :nth-child(n+5), .crm-cards > :nth-child(n+5) { animation-delay: .16s; }
.crm-card:hover, .cafe-ev:hover, .kpi:hover, .flow-card:hover { border-color: color-mix(in srgb, var(--emerald-2) 40%, var(--line)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--emerald-2) 18%, transparent), 0 10px 30px -14px color-mix(in srgb, var(--emerald-2) 55%, transparent); }
@media (hover: hover) { .crm-card:hover, .cafe-ev:hover { transform: translateY(-2px); } }
.row { transition: background .18s; }
.row.on { background: linear-gradient(90deg, color-mix(in srgb, var(--emerald-2) 16%, transparent), var(--brand-soft) 60%); box-shadow: inset 3px 0 0 var(--emerald-2); }
.metric-icon { background: linear-gradient(140deg, color-mix(in srgb, var(--emerald-2) 22%, var(--surface)), var(--brand-soft)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--emerald-2) 20%, transparent); }
.kpi b { background: linear-gradient(180deg, var(--ink), color-mix(in srgb, var(--ink) 70%, var(--emerald))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.view-head h1 > span, .product-heading h1 > span { color: var(--emerald-2); }

/* Dourado só no que pede atenção */
.wa-pill.ok { color: var(--brand-ink); background: var(--brand-soft); }
.board-live i, .workspace-brand > i { background: var(--gold-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold-2) 22%, transparent), 0 0 8px var(--gold-2); }

/* Assistente de dúvidas e faixa de instalar no esmeralda */
.hb-fab .i, .hb-orb, .hb-form button, .inst-go { color: #fff; background: var(--brand-grad); box-shadow: 0 6px 18px -6px rgba(139, 92, 246, .7), 0 0 14px -4px rgba(34, 211, 238, .5); }
.hb-msg.u { background: var(--brand-grad); color: #fff; }
.inst-app-fb { background: var(--brand-grad); }

/* Entrada (login/convite): aurora em movimento e cartão de vidro */
.auth { position: relative; isolation: isolate; overflow: hidden; background: var(--night); }
.auth::before, .auth::after { content: ""; position: absolute; z-index: -1; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(60px); pointer-events: none; animation: shk-aurora 14s ease-in-out infinite alternate; }
.auth::before { left: -25vmax; top: -30vmax; background: radial-gradient(circle, rgba(31, 169, 130, .5), transparent 62%); }
.auth::after { right: -25vmax; bottom: -35vmax; background: radial-gradient(circle, rgba(124, 58, 237, .32), rgba(6, 182, 212, .16) 40%, transparent 62%); animation-delay: -7s; }
.auth-card { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); border: 1px solid color-mix(in srgb, #fff 14%, transparent); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .12); animation: shk-rise .6s var(--ease-out) both; }

/* Celular: barra de baixo de vidro, ícone ativo aceso */
@media (max-width: 860px) {
    .rail { background: color-mix(in srgb, var(--rail) 88%, transparent); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5); border-top: 1px solid rgba(127, 224, 185, .1); border-right: 0; }
    .rail-items a.on:not(.brand-home) { background: none; box-shadow: none; color: var(--mint); }
    .rail-items a.on:not(.brand-home) .i { filter: drop-shadow(0 0 6px rgba(34, 211, 238, .7)); }
    .rail-items a.on:not(.brand-home)::before { left: 50%; top: 0; bottom: auto; width: 22px; height: 3px; transform: translateX(-50%); border-radius: 0 0 3px 3px; }
    .rail { --rail-ink: #A3B8AE; }
    .rail-items .brand-home, .rail-items .brand-home.on { animation: none; background: none; box-shadow: none; color: var(--rail-ink); }
    .rail-items .brand-home.on { color: var(--mint); }
    .rail-items .brand-home.on .i { filter: drop-shadow(0 0 6px rgba(34, 211, 238, .7)); }
    .rail-items .brand-home::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Celular no tema claro: barra de baixo branca, como Google e Meta (ícone ativo com pílula esmeralda) */
@media (max-width: 860px) {
    :root:not([data-theme="dark"]) .rail { --rail-ink: #5F6368; background: rgba(255, 255, 255, .9); border-top: 1px solid var(--line); box-shadow: 0 -1px 3px rgba(60, 64, 67, .06); }
    :root:not([data-theme="dark"]) .rail-items a.on:not(.brand-home), :root:not([data-theme="dark"]) .rail-items .brand-home.on { color: var(--brand-ink); }
    :root:not([data-theme="dark"]) .rail-items a.on .i { filter: none; }
    :root:not([data-theme="dark"]) .rail-items a.on:not(.brand-home)::before { display: none; }
    :root:not([data-theme="dark"]) .rail-items a.on .i, :root:not([data-theme="dark"]) .rail-items .brand-home.on .i { background: var(--brand-soft); border-radius: 999px; padding: 3px 14px; box-sizing: content-box; }
    :root:not([data-theme="dark"]) .rail .dot { border-color: #fff; }
}
@media (max-width: 860px) and (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .rail { --rail-ink: #A3B8AE; background: color-mix(in srgb, var(--rail) 88%, transparent); border-top: 1px solid rgba(127, 224, 185, .1); box-shadow: none; }
    :root:not([data-theme="light"]) .rail-items a.on:not(.brand-home), :root:not([data-theme="light"]) .rail-items .brand-home.on { color: var(--mint); }
    :root:not([data-theme="light"]) .rail-items a.on .i { background: none; padding: 0; filter: drop-shadow(0 0 6px rgba(34, 211, 238, .7)); }
    :root:not([data-theme="light"]) .rail .dot { border-color: var(--rail); }
}

/* Caixa de mensagem igual ao WhatsApp Web: uma pílula só (anexo, IA, texto e microfone dentro).
   Vazia mostra o microfone; com texto, o microfone vira o botão verde de enviar. */
.composer { align-items: center; gap: 0; padding: 6px 16px 10px; background: var(--wa-bg); border-top: 0; }
.composer .field { align-items: center; min-height: 48px; padding: 4px 52px 4px 6px; border-radius: 24px; background: var(--composer-field); box-shadow: 0 1px 2px rgba(11, 20, 26, .08); }
:root[data-theme="dark"] .composer .field { box-shadow: none; }
.composer .field .icon-btn, .composer > .rec-btn { width: 40px; height: 40px; color: var(--wa-meta); background: none; }
.composer .field .icon-btn:hover, .composer > .rec-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.composer textarea { padding: 10px 6px; font-size: 15px; }
.composer > .rec-btn, .composer > .send { position: relative; z-index: 3; flex: none; margin-left: -48px; border-radius: 50%; }
.composer > .send { width: 40px !important; height: 40px !important; background: var(--brand) !important; color: #fff !important; box-shadow: none !important; transform: none; animation: none; }
.composer > .send:hover { background: var(--brand-ink) !important; transform: none; box-shadow: none; }
.composer > .send .i { width: 20px; height: 20px; }
.composer:has(#text:placeholder-shown) > .send { display: none; }
.composer:not(:has(#text:placeholder-shown)) > .rec-btn { display: none; }
.composer.recording .rec-bar { flex: 1; }
.composer.note-mode { background: var(--t-pe-bg); }
.composer.note-mode > .rec-btn { display: none; }
.composer.note-mode > .send { display: grid; background: var(--t-pe) !important; }
@media (max-width: 860px) { .composer { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); } }

/* Lista: conversa aberta em cinza, como no WhatsApp original */
.row.on, .row.on:hover { background: var(--surface-2); box-shadow: none; }
.row:hover { background: var(--hover); }

/* Reações nas mensagens (como no WhatsApp): selo embaixo do balão e botão de reagir ao passar o mouse */
.msg.has-react { margin-bottom: 20px; padding-bottom: 12px; }
.msg > .reacts { position: absolute; bottom: -17px; left: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 1px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--wa-in); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(11, 20, 26, .12); font-size: 14px; line-height: 1; cursor: default; }
.msg.out > .reacts { left: auto; right: 8px; }
.msg > .reacts b { margin-left: 3px; font: 600 11px var(--font); color: var(--wa-meta); }
.msg > .msg-act { position: absolute; top: 50%; right: -38px; width: 30px; height: 30px; margin-top: -15px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface); color: var(--wa-meta); box-shadow: 0 1px 3px rgba(11, 20, 26, .18); opacity: 0; pointer-events: none; transition: opacity .15s; }
.msg.out > .msg-act { right: auto; left: -38px; }
.msg:hover > .msg-act, .msg > .msg-act:focus-visible { opacity: 1; pointer-events: auto; }
.msg > .msg-act:hover { color: var(--ink); }
@media (hover: none) { .msg > .msg-act { display: none; } .msg { -webkit-touch-callout: none; } }

/* Menu da mensagem: bandeja de reações e ações */
.msg-menu { position: fixed; z-index: 1000; min-width: 240px; padding: 6px; border-radius: 16px; background: var(--surface); box-shadow: 0 2px 5px rgba(11, 20, 26, .2), 0 12px 32px -8px rgba(11, 20, 26, .3); animation: fade .12s; }
.mm-reacts { display: flex; gap: 2px; }
.mm-reacts button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font-size: 24px; line-height: 1; cursor: pointer; transition: transform .12s, background .12s; }
.mm-reacts button:hover { transform: scale(1.18); background: var(--surface-2); }
.mm-reacts button.on { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--brand); }
.mm-item { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 0; border-top: 1px solid var(--line-2); border-radius: 0 0 10px 10px; background: none; color: var(--ink); font: 500 14px var(--font); text-align: left; cursor: pointer; }
.mm-item:hover { background: var(--hover); }
.mm-item.danger { color: #d93025; }
.mm-note { display: block; margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: 12px; line-height: 1.35; }

/* Mensagem apagada ou não disponível */
.msg.is-del .txt.del { display: flex; align-items: flex-start; gap: 6px; color: var(--wa-meta); font-style: italic; white-space: normal; }
.msg.is-del .txt.del > svg { flex: none; margin-top: 2px; }
.msg.is-del .txt.del > span { flex: 1; min-width: 0; }
.msg.is-del .txt.del small { display: block; margin-top: 2px; font-style: normal; font-size: 12px; line-height: 1.35; }
.msg.is-del .del-orig { margin-top: 3px; font-style: normal; }
.msg.is-del .del-orig summary { cursor: pointer; font-size: 12px; color: var(--wa-link); list-style: none; }
.msg.is-del .del-orig summary::-webkit-details-marker { display: none; }
.msg.is-del .del-orig p { margin: 4px 0 0; padding: 6px 8px; border-left: 3px solid var(--line); color: var(--ink-2); white-space: pre-wrap; font-size: 13px; }
.msg.is-del .meta { align-self: flex-end; margin-left: 8px; }

/* Como no WhatsApp Web: setinha dentro do balão (ações) e carinha ao lado (reagir), só ao passar o mouse */
.msg > .msg-more { position: absolute; top: 3px; right: 3px; z-index: 2; width: 28px; height: 24px; display: grid; place-items: center; padding: 0 0 0 6px; border: 0; border-radius: 0 6px 0 14px; color: var(--wa-meta); background: radial-gradient(farthest-side at 70% 40%, var(--wa-in) 60%, transparent); opacity: 0; pointer-events: none; transition: opacity .12s; cursor: pointer; }
.msg.out > .msg-more { background: radial-gradient(farthest-side at 70% 40%, var(--wa-out) 60%, transparent); }
.msg.solo > .msg-more, .msg.is-image > .msg-more, .msg.is-video > .msg-more { color: #fff; background: radial-gradient(farthest-side at 70% 30%, rgba(0, 0, 0, .35), transparent); }
.msg:hover > .msg-more, .msg > .msg-more:focus-visible { opacity: 1; pointer-events: auto; }
.msg > .msg-act { background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: none; }
.msg > .msg-act:hover { background: var(--surface); box-shadow: 0 1px 3px rgba(11, 20, 26, .18); }
@media (hover: none) { .msg > .msg-more { display: none; } }

.msg-menu.is-react { min-width: 0; padding: 4px 6px; border-radius: 999px; }
.msg-menu.is-react:has(.mm-grid:not([hidden])) { border-radius: 18px; }
.mm-reacts { align-items: center; }
.mm-reacts .mm-plus { width: 34px; height: 34px; margin-left: 2px; display: grid; place-items: center; font-size: 0; color: var(--wa-meta); background: var(--surface-2); }
.mm-reacts .mm-plus:hover { transform: none; color: var(--ink); }
.mm-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; max-width: 100%; padding: 6px 2px 2px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.mm-grid button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; font-size: 22px; cursor: pointer; }
.mm-grid button:hover, .mm-grid button.on { background: var(--surface-2); }
.msg-menu.is-more { min-width: 200px; padding: 6px 0; border-radius: 10px; }
.msg-menu.is-more .mm-item, .msg-menu.is-both .mm-list .mm-item { margin: 0; border: 0; border-radius: 0; padding: 10px 20px; }
.msg-menu.is-more .mm-note { margin: 4px 0 0; padding: 8px 20px 4px; }
.msg-menu.is-both { padding: 6px; border-radius: 18px; }
.msg-menu.is-both .mm-list { margin-top: 6px; border-top: 1px solid var(--line-2); padding-top: 4px; }
@media (max-width: 420px) { .mm-reacts button { width: 36px; height: 36px; font-size: 22px; } .mm-grid { grid-template-columns: repeat(7, 36px); } }

/* Carinha e setinha não somem no caminho do mouse: ponte invisível até o balão e meio segundo de tolerância */
.msg > .msg-act, .msg > .msg-more { pointer-events: auto; visibility: hidden; transition: opacity .15s ease .25s, visibility 0s linear .4s; }
.msg:hover > .msg-act, .msg:hover > .msg-more, .msg > .msg-act:focus-visible, .msg > .msg-more:focus-visible { visibility: visible; transition-delay: 0s; }
.msg > .msg-act::before { content: ""; position: absolute; top: -12px; bottom: -12px; left: -14px; right: -4px; }
.msg.out > .msg-act::before { left: -4px; right: -14px; }

/* ===== Fiel ao WhatsApp Web: carinha colada ao balão, bandeja compacta, menu com ícones ===== */
.msg > .msg-act { top: 50%; right: -31px; width: 25px; height: 25px; margin-top: -12.5px; border-radius: 50%; color: #54656f; background: rgba(255, 255, 255, .8); box-shadow: none; }
.msg.out > .msg-act { right: auto; left: -31px; }
.msg > .msg-act svg { width: 17px; height: 17px; stroke-width: 1.7; }
.msg > .msg-act:hover { background: #fff; box-shadow: none; color: #3b4a54; }
:root[data-theme="dark"] .msg > .msg-act { color: #aebac1; background: rgba(32, 44, 51, .85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg > .msg-act { color: #aebac1; background: rgba(32, 44, 51, .85); } }
.msg > .msg-act::before { top: -8px; bottom: -8px; left: -8px; right: -2px; }
.msg.out > .msg-act::before { left: -2px; right: -8px; }
.msg > .msg-more { width: 24px; height: 22px; top: 2px; right: 2px; }
.msg > .msg-more svg { width: 18px; height: 18px; }

.msg-menu { box-shadow: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16); }
.msg-menu.is-react { padding: 3px 6px; border-radius: 999px; }
.mm-reacts { gap: 0; }
.mm-reacts button { width: 34px; height: 34px; font-size: 21px; }
.mm-reacts button:hover { transform: scale(1.12); background: none; }
.mm-reacts button.on { background: #e9edef; box-shadow: none; }
.mm-reacts .mm-plus { width: 30px; height: 30px; margin-left: 2px; background: none; color: #54656f; }
.mm-reacts .mm-plus:hover { background: #f0f2f5; }
.mm-grid button.on { background: #e9edef; }
.msg-menu.is-more { min-width: 196px; padding: 8px 0; border-radius: 12px; }
.msg-menu .mm-item { display: flex; align-items: center; gap: 14px; font-size: 14.5px; font-weight: 400; color: #3b4a54; }
.msg-menu .mm-item svg { flex: none; color: #54656f; }
.msg-menu .mm-item.danger, .msg-menu .mm-item.danger svg { color: #ea0038; }
.msg-menu.is-more .mm-item { padding: 9px 20px; }
:root[data-theme="dark"] .msg-menu .mm-item, :root[data-theme="dark"] .msg-menu .mm-item svg { color: #d1d7db; }
:root[data-theme="dark"] .mm-reacts button.on, :root[data-theme="dark"] .mm-grid button.on { background: #2a3942; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .msg-menu .mm-item, :root:not([data-theme="light"]) .msg-menu .mm-item svg { color: #d1d7db; }
    :root:not([data-theme="light"]) .mm-reacts button.on, :root:not([data-theme="light"]) .mm-grid button.on { background: #2a3942; }
}

/* Citação de resposta dentro do balão */
.msg .quote { display: flex; align-items: stretch; width: 100%; min-width: 180px; margin: 0 0 4px; padding: 0; border: 0; border-left: 4px solid #53bdeb; border-radius: 7.5px; background: rgba(11, 20, 26, .05); color: inherit; text-align: left; font: inherit; cursor: pointer; overflow: hidden; }
.msg.out .quote { background: rgba(11, 20, 26, .06); }
.msg .quote.q-me, .reply-bar.q-me .quote { border-left-color: #06cf9c; }
.msg .quote > span, .reply-bar .quote > span { flex: 1; min-width: 0; padding: 5px 10px 6px 8px; }
.msg .quote b, .reply-bar .quote b { display: block; font-size: 12.8px; font-weight: 500; line-height: 20px; color: #53bdeb; }
.msg .quote.q-me b, .reply-bar.q-me .quote b { color: #06cf9c; }
.msg .quote i, .reply-bar .quote i { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-style: normal; font-size: 13.2px; line-height: 18px; color: var(--wa-meta); white-space: pre-wrap; }
.msg .quote img, .reply-bar .quote img { flex: none; width: 56px; height: auto; min-height: 56px; object-fit: cover; }
:root[data-theme="dark"] .msg .quote { background: rgba(0, 0, 0, .2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg .quote { background: rgba(0, 0, 0, .2); } }
.msg.flash { animation: msg-flash 1.4s ease; }
@keyframes msg-flash { 0%, 60% { box-shadow: 0 0 0 4px color-mix(in srgb, #53bdeb 45%, transparent); } 100% { box-shadow: var(--bubble-shadow); } }

/* Faixa "Respondendo" acima da caixa de mensagem */
.composer { flex-wrap: wrap; }
.reply-bar { flex: 0 0 100%; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 6px 4px 6px 6px; border-radius: 16px; background: var(--composer-field); box-shadow: 0 1px 2px rgba(11, 20, 26, .08); animation: fade .15s; }
.reply-bar .quote { flex: 1; min-width: 0; display: flex; border-left: 4px solid #53bdeb; border-radius: 7.5px; background: var(--surface-2); overflow: hidden; }
.reply-bar .icon-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; color: var(--wa-meta); background: none; }

/* Arrastar para responder (celular) */
.msg.swipe-ready::after { content: "↩"; position: absolute; left: -34px; top: 50%; width: 26px; height: 26px; margin-top: -13px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .85); color: #54656f; font-size: 15px; }

/* Carinha: ícone exatamente no centro do círculo (sem o recuo padrão do botão) e mais perto do balão */
.msg > .msg-act { display: flex; align-items: center; justify-content: center; padding: 0; right: -30px; width: 24px; height: 24px; margin-top: -12px; line-height: 0; background: rgba(255, 255, 255, .9); color: #54656f; }
.msg.out > .msg-act { left: -30px; }
.msg > .msg-act svg { display: block; width: 18px; height: 18px; margin: 0; stroke-width: 1.6; }
.msg-menu.is-react { padding: 4px 6px; }
.mm-reacts button { display: flex; align-items: center; justify-content: center; padding: 0; width: 32px; height: 32px; font-size: 20px; }
.mm-reacts .mm-plus { width: 30px; height: 30px; }

/* Bandeja de reações menor, como no WhatsApp Web */
.msg-menu.is-react { padding: 2px 4px; }
.mm-reacts button { width: 28px; height: 28px; font-size: 18px; }
.mm-reacts .mm-plus { width: 26px; height: 26px; margin-left: 1px; }
.mm-reacts .mm-plus svg { width: 17px; height: 17px; }

/* Bandeja de reações ainda mais compacta */
.msg-menu.is-react { padding: 2px 3px; }
.mm-reacts button { width: 24px; height: 24px; font-size: 15.5px; }
.mm-reacts .mm-plus { width: 22px; height: 22px; }
.mm-reacts .mm-plus svg { width: 15px; height: 15px; }

/* Celular: mensagem selecionada em destaque enquanto a bandeja e as ações estão abertas */
.msg.msg-selected { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent), var(--bubble-shadow); }
.msg-menu.is-more.touch { min-width: 220px; }
/* No celular a bandeja fica do tamanho do dedo, como no WhatsApp do celular */
.msg-menu.is-react.touch { padding: 4px 6px; }
.msg-menu.is-react.touch .mm-reacts button { width: 38px; height: 38px; font-size: 25px; }
.msg-menu.is-react.touch .mm-plus { width: 32px; height: 32px; }
.msg-menu.is-react.touch .mm-plus svg { width: 20px; height: 20px; }

/* Convite / nova senha na Equipe: status do e-mail, link e ações (reenviar, WhatsApp) */
.invite-box { display: grid; gap: 12px; }
.invite-head { display: flex; align-items: flex-start; gap: 12px; }
.invite-head > div { display: grid; gap: 2px; }
.invite-head small { color: var(--ink-3); font-size: 13px; }
.invite-ic { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.invite-mail { display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; }
.invite-mail.ok { background: var(--brand-soft); color: var(--brand-ink); }
.invite-mail.err { background: var(--t-ag-bg); color: var(--t-ag); }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-actions form { margin: 0; }
.btn.wa-btn { background: #25D366 !important; color: #0b141a !important; box-shadow: none !important; }
.btn.wa-btn:hover { filter: brightness(.96); }

/* Minha senha */
.view-in.narrow { max-width: 520px; }
.pw-card { display: grid; gap: 14px; padding: 20px; }
.pw-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.auth-card .link.center, .link.center { display: block; text-align: center; margin-top: 4px; font-size: 13px; }

/* Etiqueta de dica (hover) no estilo do menu lateral */
.shk-tip { position: fixed; z-index: 2000; max-width: 260px; padding: 5px 10px; border-radius: 8px; background: #07081A; color: #fff; font: 500 12px/1.35 var(--font); letter-spacing: 0; white-space: nowrap; border: 1px solid rgba(127, 224, 185, .15); box-shadow: 0 8px 24px rgba(0, 0, 0, .28); pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; }
.shk-tip.below { transform: translateY(-3px); }
.shk-tip.show { opacity: 1; transform: none; }
.shk-tip::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -4px; width: 8px; height: 8px; margin-left: -4px; background: #07081A; border-right: 1px solid rgba(127, 224, 185, .15); border-bottom: 1px solid rgba(127, 224, 185, .15); transform: rotate(45deg); }
.shk-tip.below::after { bottom: auto; top: -4px; transform: rotate(225deg); }

/* Equipe: quantos candidatos estão com cada mestre, abaixo das regiões */
.team-load { display: block; margin-top: 4px; color: var(--ink-3); font-size: 12px; }

/* Coordenador: encaminhar para o mestre da UF com um toque */
.forward-btn { width: 100%; margin: 8px 0 2px; justify-content: center; }


/* ---------- Coordenador: encaminhar ao mestre (barra fixa no topo da conversa) ---------- */
.handoff { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: color-mix(in srgb, #B8913A 10%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, #B8913A 28%, var(--line)); animation: shk-rise .25s ease-out both; }
.handoff[hidden] { display: none; }
.ho-text { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ho-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #B8913A 18%, transparent); color: #8A6A22; }
.ho-ico svg { width: 17px; height: 17px; }
.ho-text strong { display: block; font-size: 14px; color: var(--ink); }
.ho-text small { display: block; font-size: 12.5px; color: var(--ink-2); }
.ho-text small b { color: var(--ink); }
.ho-act { display: flex; align-items: center; gap: 8px; flex: 1 1 300px; justify-content: flex-end; max-width: 460px; }
.ho-act select { flex: 1 1 150px; min-width: 0; height: 38px; }
.ho-go { flex: none; height: 38px; gap: 6px; white-space: nowrap; }
.ho-go:disabled { opacity: .55; }
.row-handoff { flex: none; display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, #B8913A 16%, transparent); color: #7A5C1B; }
.ok-toast .shk-toast-av svg { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ho-ico, :root:not([data-theme="light"]) .row-handoff { color: #E2C27A; } }
:root[data-theme="dark"] .ho-ico, :root[data-theme="dark"] .row-handoff { color: #E2C27A; }
@media (max-width: 720px) { .handoff { padding: 10px 12px; } .ho-act { max-width: none; flex-basis: 100%; } }

/* Conversa um pouco menor, na proporção do resto do painel (desktop). */
@media (min-width: 861px) {
    .msg { font-size: 12.2px; line-height: 16.5px; }
    .msg em { font-size: 10.8px; }
    .msg .meta { font-size: 10px; }
    .msg .quote b { font-size: 11.3px; line-height: 16px; }
    .msg .quote i { font-size: 11.7px; line-height: 15.5px; }
    .msg.is-del .del-orig p { font-size: 11.7px; }
}

/* Botões da etapa (Automática / Café / Aprovado): cabem com folga no painel. */
.stage-opts { gap: 5px; }
.stage-opts button { gap: 4px; padding: 0 5px; font-size: 11.2px; letter-spacing: -.1px; }
.stage-opts button .i, .stage-opts button svg { width: 12px; height: 12px; flex: none; }


/* Barra de encaminhar: tamanhos padrão do painel (botão igual ao "Reanalisar agora"). */
.handoff { gap: 10px; padding: 6px 14px; }
.ho-text { gap: 9px; }
.ho-ico { width: 26px; height: 26px; }
.ho-ico svg { width: 14px; height: 14px; }
.ho-text strong { font-size: 12.5px; line-height: 16px; }
.ho-text small { font-size: 11.5px; line-height: 15px; }
.ho-act { gap: 6px; flex: 0 1 auto; max-width: none; }
.ho-act select.input, .ho-act select { flex: 0 1 190px; width: 190px; height: 28px; min-height: 28px; padding: 0 26px 0 9px; font-size: 12px; border-radius: 8px; }
.handoff .ho-go { height: 28px; min-height: 28px; padding: 0 12px; gap: 6px; font-size: 11.5px; font-weight: 600; border-radius: 8px; box-shadow: none; }
.handoff .ho-go svg { width: 14px; height: 14px; }
@media (max-width: 720px) { .handoff { padding: 8px 12px; } .ho-act { flex-basis: 100%; } .ho-act select.input, .ho-act select { flex: 1 1 auto; width: auto; } }


/* Métricas: recepção dos compradores (obrigado → conversa → grupo). */
.reception .rc-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 4px 16px 16px; }
.rc-step { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--c, var(--ink-3)); border-radius: 10px; background: var(--surface); }
.rc-step small { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.rc-step b { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--ink); }
.rc-step span { font-size: 11.5px; color: var(--ink-3); }


/* ---------- 13/11: logo do menu sempre quadrado, com o número inteiro ---------- */
.rail-items .brand-home, .rail-items .brand-home.on { overflow: visible; aspect-ratio: 1; }
@media (min-width: 861px) and (max-height: 780px) { .rail-items .brand-home, .rail-items .brand-home.on { width: 36px; height: 36px; } }
@media (min-width: 861px) and (max-height: 640px) { .rail-items .brand-home, .rail-items .brand-home.on { width: 34px; height: 34px; } }
.rail-items .brand-home .rail-badge { top: -6px; right: -7px; z-index: 2; }

/* ---------- 13/11: lista de conversas na proporção do WhatsApp Web (computador) ---------- */
@media (min-width: 861px) {
    #chats .row { min-height: 0; margin: 0 6px; padding: 0 10px; gap: 12px; border-radius: 8px; align-items: center; }
    #chats .row .avatar { width: 44px; height: 44px; font-size: 14px; flex: none; }
    #chats .row .mid { padding: 9px 0; border: 0; }
    #chats .row .line1 strong { font-size: 14px; font-weight: 400; line-height: 1.35; color: var(--ink); }
    #chats .row.unread .line1 strong { font-weight: 500; }
    #chats .row .line1 time { font-size: 11px; }
    #chats .row .line2 { margin-top: 1px; }
    #chats .row .line2 small { font-size: 12.5px; line-height: 1.35; color: var(--ink-2); }
    #chats .row.unread .line2 small { color: var(--ink); }
    #chats .row .line2 .count { min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; }
    #chats .row-meta3 { margin-top: 4px; gap: 9px; font-size: 11px; }
    #chats .row-meta3 .row-status { height: 16px; padding: 0 6px; font-size: 10px; font-weight: 600; }
    #chats .row-meta3 .row-handoff { height: 16px; padding: 0 6px; font-size: 10px; }
}

/* Número de notificações no logo: só o círculo, sem borda nem brilho (como no WhatsApp). */
.rail-badge { min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; box-shadow: none; }
.rail-items .brand-home .rail-badge { top: -5px; right: -6px; }


/* ---------- 13/11: contador e horário no padrão do WhatsApp; lista mais larga ---------- */
.row.unread .line1 time { color: var(--brand); font-weight: 500; }
.count, #chats .row .line2 .count { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--brand); box-shadow: none; color: #fff; font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; align-self: center; }
#chats .row .line2 { align-items: center; }
@media (min-width: 1280px) { .inbox { grid-template-columns: 56px clamp(360px, 27vw, 420px) minmax(0, 1fr) auto; } }
@media (min-width: 861px) and (max-width: 1279px) { .inbox { grid-template-columns: 56px 360px minmax(0, 1fr); } }
/* Sem região (antes do encaminhamento): só o ícone. */
.row-region.none { color: var(--ink-3); opacity: .8; }
.row-region.none .i { width: 12px; height: 12px; }

/* Prévia da lista: letra menor e o tique alinhado com o nome (o desenho do tique começa 2 px para dentro). */
@media (min-width: 861px) {
    #chats .row .line2 small { font-size: 12px; }
    #chats .row .line2 small .tick { flex: none; width: 15px; height: 10px; margin: 0 2px 0 -2px; }
}

/* Tooltip do logo: o brilho do logo usa a mesma camada (::after) e esticava a etiqueta. */
@media (min-width: 861px) {
    .rail-items .brand-home[data-label]:hover::after { inset: auto; left: 54px; top: 50%; right: auto; bottom: auto; transform: translateY(-50%); width: auto; height: auto; padding: 6px 10px; border-radius: 8px; background: var(--night); background-size: auto; border: 1px solid rgba(127, 224, 185, .15); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); animation: shk-tip .12s ease-out; z-index: 5; }
}


/* Automações: fila de recepção (link do grupo para quem já chamou). */
.rc-backlog { margin: 14px 0 0; padding: 14px 16px; display: grid; gap: 10px; }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rc-head b { display: block; font-size: 14px; }
.rc-head small { display: block; color: var(--ink-2); font-size: 12.5px; }
.rc-preview { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.rc-preview span { display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.rc-warn { margin: 0; color: var(--t-ag-c); font-size: 12.5px; }
.rc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.rc-list label { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.rc-list label:hover { background: var(--hover); }
.rc-list b { font-size: 13px; font-weight: 500; }
.rc-list small, .rc-list em { grid-column: 2; font-size: 11.5px; color: var(--ink-3); font-style: normal; }
.rc-list em { color: var(--t-pe-c); }
.rc-head .btn b { font-weight: inherit; }


/* "Ver como" (admin principal): faixa fixa no topo e a página de escolha. */
.viewas-bar { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 6px 6px 6px 14px; border-radius: 999px; background: #B8913A; color: #1b1406; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.viewas-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewas-bar .i { flex: none; }
.viewas-bar button { flex: none; height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: #1b1406; color: #fff; font: 600 12px var(--font); cursor: pointer; }
.viewas-bar button:hover { background: #000; }
@media (max-width: 860px) { .viewas-bar { top: auto; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); } }
.vc .vc-group { padding: 16px; margin-top: 14px; }
.vc .vc-group h2 { margin: 0 0 8px; font-size: 15px; }
.vc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.vc-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 4px; border-radius: 8px; }
.vc-list li:hover { background: var(--hover); }
.vc-list .me-av { width: 34px; height: 34px; }
.vc-list b { display: block; font-size: 13.5px; font-weight: 500; }
.vc-list small { display: block; font-size: 12px; color: var(--ink-3); }
@media (min-width: 861px) { .viewas-bar { top: auto; left: 66px; bottom: 14px; transform: none; max-width: 520px; } }
@media (min-width: 861px) { .viewas-bar { max-width: 320px; } }
@media (min-width: 861px) { .viewas-bar { left: 62px; max-width: 332px; gap: 7px; padding-left: 11px; font-size: 12px; } .viewas-bar button { padding: 0 11px; } }

.wolf-sync { color: var(--ink-3); }
.wolf-sync.late { color: var(--t-ag-c); font-weight: 600; }

.rc-sec .rc-done { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--ink-2); }
.rc-sec .rc-done .i { width: 15px; height: 15px; color: var(--brand); }
.rc-sec .rc-send { gap: 6px; }
.rc-sec .rc-send .i { width: 14px; height: 14px; }
.rc-sec small { display: block; margin-top: 6px; font-size: 11.5px; }

/* Automações: conexão do provedor principal no padrão dos cartões de Configurações (clicável, verde/vermelho). */
.fx-conn { color: inherit; text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.fx-conn:hover { border-color: var(--brand); }
.fx-conn .settings-status { display: inline-flex; margin-top: 6px; }
.fx-conn .settings-go { font-size: 20px; color: var(--ink-3); }
.fx-conn.down { border-color: color-mix(in srgb, var(--t-ag-c) 45%, var(--line)); }
.fx-conn .settings-status.ok { color: var(--t-ap-c); } .fx-conn .settings-status.off { color: var(--t-ag-c); }

/* Automações: números clicáveis (cartões e etapas) e lista de quem está no fluxo. */
.fx-item-stats button { display: grid; place-items: center; padding: 6px 10px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink-3); font: 500 10.5px var(--font); cursor: pointer; transition: background .15s, box-shadow .15s; }
.fx-item-stats button b { font-size: 15px; color: var(--ink); }
.fx-item-stats button:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--brand); }
.fx-item-stats button.bad b { color: var(--t-ag-c); }
.fx-node-stats button { padding: 1px 7px; border-radius: 999px; font: 700 10.5px var(--font); background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); cursor: pointer; }
.fx-node-stats button:hover { border-color: var(--brand); }
.fx-node-stats button.passed { background: var(--t-ap-bg); color: var(--t-ap); }
.fx-node-stats button.failed { background: var(--t-ag-bg); color: var(--t-ag); }
.fx-node-stats button.waiting { background: var(--t-ca-bg, var(--surface-2)); color: var(--t-ca, var(--ink-2)); }
.fx-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.fx-people li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.fx-people li:hover { background: var(--hover); }
.fx-people b { display: block; font-size: 13.5px; font-weight: 500; }
.fx-people small, .fx-people span:not(.chip) { display: block; font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.fx-people-count { margin: 0 0 6px; font-size: 12px; }
.rc-head .btn { white-space: nowrap; } .rc-btn-label, .rc-btn-label span { display: inline; }

/* ---------- Menu da conversa (botão direito) e folha do celular ---------- */
.chat-menu { min-width: 230px; }
.chat-menu .mm-item, .chat-sheet .mm-item { display: flex; align-items: center; gap: 12px; }
.chat-menu .mm-item svg, .chat-sheet .mm-item svg { flex: none; color: var(--ink-2); }
.chat-menu .mm-item { padding: 9px 18px; font-size: 13.5px; }
#chats .row.menu-on { background: var(--hover); }
.row-pin { display: inline-flex; flex: none; color: var(--ink-3); }
.row-pin svg { width: 14px; height: 14px; }
/* Celular: folha que sobe de baixo */
.chat-sheet { position: fixed; inset: 0; z-index: 1000; }
.chat-sheet .cs-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0); transition: background .2s; }
.chat-sheet.open .cs-backdrop { background: rgba(0, 0, 0, .38); }
.chat-sheet .cs-panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0; background: var(--surface); box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .9, .3, 1); }
.chat-sheet.open .cs-panel { transform: none; }
.chat-sheet .cs-grip { display: block; width: 38px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: var(--line); }
.chat-sheet .cs-head { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; border-bottom: 1px solid var(--line-2); }
.chat-sheet .cs-head .avatar { width: 44px; height: 44px; }
.chat-sheet .cs-head b { display: block; font-size: 16px; font-weight: 600; }
.chat-sheet .cs-head small { display: block; font-size: 13px; color: var(--ink-3); }
.chat-sheet .cs-list { display: grid; padding: 6px 0; }
.chat-sheet .mm-item { margin: 0; padding: 14px 8px; border: 0; border-radius: 10px; font-size: 16px; }
.chat-sheet .mm-item:active { background: var(--hover); }
.chat-sheet .cs-cancel { width: 100%; height: 50px; margin-top: 4px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink); font: 600 16px var(--font); }
/* Celular: arrastar a conversa (direita = lida/não lida, esquerda = fixar) */
#chats .row.swiping { transition: none; position: relative; z-index: 1; background: var(--surface); }
#chats .row:not(.swiping) { transition: transform .2s ease, background .18s; }
#chats .row.swiping::before { content: attr(data-sw-label); position: absolute; top: 0; bottom: 0; width: 120px; display: flex; align-items: center; padding: 0 14px; color: #fff; font: 600 14px var(--font); }
#chats .row.sw-right::before { right: 100%; justify-content: flex-end; background: #3b82f6; }
#chats .row.sw-left::before { left: 100%; justify-content: flex-start; background: #6b7280; }
#chats .row.sw-go.sw-right::before { background: #1d4ed8; }
#chats .row.sw-go.sw-left::before { background: #374151; }
@media (prefers-reduced-motion: reduce) { .chat-sheet .cs-panel, .chat-sheet .cs-backdrop, #chats .row:not(.swiping) { transition: none; } }

.reply-group-title { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; font-size: 15px; }
.reply-group-title small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.reply-card[disabled] { cursor: default; opacity: .92; }
.quick-team { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font: 600 10px var(--font); font-style: normal; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- SMS (conta do admin principal) ---------- */
.sms-page .view-head { align-items: center; }
.sms-balance { display: grid; justify-items: end; padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.sms-balance small { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sms-balance b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--brand); }
.sms-balance span { font-size: 12px; color: var(--ink-3); }
.sms-kpis { margin: 14px 0; }
.sms-kpis .sms-prov { font-size: 17px; }
.sms-tabs { display: flex; flex-wrap: wrap; margin-bottom: 14px; }
.sms-card { padding: 16px 18px; margin-bottom: 14px; display: grid; gap: 12px; }
.sms-card h2 { margin: 0; font-size: 15px; }
.sms-form { max-width: 760px; }
.sms-sub { display: block; font-size: 11.5px; color: var(--ink-3); }
.sms-count { margin: -6px 0 0; font-size: 12px; color: var(--ink-3); }
.sms-aud { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; }
.sms-aud legend { padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.sms-aud .seg label { display: inline-flex; align-items: center; gap: 6px; }
.sms-aud .seg input { display: none; }
.sms-crm { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sms-crm[hidden], .sms-paste[hidden] { display: none; }
.sms-preview { padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); font-size: 13px; color: var(--ink); }
.sms-preview.short { background: color-mix(in srgb, var(--t-ag-c) 14%, var(--surface)); }
.sms-preview small { display: block; margin-top: 2px; color: var(--ink-3); }
.sms-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.sms-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sms-empty { display: grid; gap: 8px; justify-items: start; padding: 10px 0; }
.sms-empty p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.sms-bar { display: block; width: 160px; max-width: 100%; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sms-bar i { display: block; height: 100%; background: var(--brand); }
.sms-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.sms-actions form { margin: 0; }
.sms-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.sms-grid .sms-card { margin: 0; }
.tbl td.neg { color: var(--t-ag-c); }
.tbl td.pos { color: var(--t-ap-c); }
.sms-provs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 10px; }
.sms-prov { margin: 0; align-content: start; }
.sms-prov.on { box-shadow: 0 0 0 2px var(--brand) inset; }
.sms-prov header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sms-opt { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sms-opt li { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.sms-opt form { margin: 0; }
.sms-msg { max-width: 360px; font-size: 12.5px; color: var(--ink-2); }
.sms-flash { margin-right: 6px; padding: 0 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font: 600 10px var(--font); font-style: normal; text-transform: uppercase; }
.tone-sms { --tone: #0ea5e9; }

/* ---------- Automações: modo livre (arrastar e soltar) ---------- */
.fx-views button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: 600 12.5px var(--font); cursor: pointer; }
.fx-views button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.fx-graph.free { display: block; padding: 0; min-width: 0; transform-origin: top left; }
.fx-free { position: relative; min-width: 100%; min-height: 100%; }
.fx-wires { position: absolute; inset: 0 auto auto 0; pointer-events: none; overflow: visible; }
.fx-wires path { fill: none; stroke: color-mix(in srgb, var(--ink-3) 70%, transparent); stroke-width: 2; }
.fx-wires path.yes { stroke: color-mix(in srgb, var(--t-ap-c) 75%, transparent); }
.fx-wires path.no { stroke: color-mix(in srgb, var(--t-ag-c) 70%, transparent); }
.fx-wires circle { fill: var(--ink-3); }
.fx-wires circle.yes { fill: var(--t-ap-c); }
.fx-wires circle.no { fill: var(--t-ag-c); }
.fx-wires text { font: 600 11px var(--font); fill: var(--ink-2); }
.fx-wires text.yes { fill: var(--t-ap-c); }
.fx-wires text.no { fill: var(--t-ag-c); }
.fx-node.free { position: absolute; width: 270px; margin: 0; cursor: grab; touch-action: none; z-index: 1; }
.fx-node.free.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 14px 30px -8px rgba(0, 0, 0, .3); transition: none; }
.fx-fadd { position: absolute; z-index: 2; display: inline-flex; align-items: center; justify-content: center; height: 22px; min-width: 22px; padding: 0 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 600 10.5px var(--font); cursor: pointer; opacity: 0; transition: opacity .15s, border-color .15s; }
.fx-node.free:hover .fx-fadd, .fx-node.free.sel .fx-fadd, .fx-node.free:focus-within .fx-fadd, .fx-fadd.first { opacity: 1; }
.fx-fadd:hover { border-color: var(--brand); color: var(--brand); }
.fx-fadd.next { left: 50%; bottom: -12px; transform: translateX(-50%); }
.fx-fadd.yes { left: 8px; bottom: -12px; color: var(--t-ap-c); }
.fx-fadd.no { right: 8px; bottom: -12px; color: var(--t-ag-c); }
.fx-node.free:has(.fx-fadd.yes) .fx-fadd.next { bottom: -36px; }
.fx-fadd.first { position: relative; margin: 60px; opacity: 1; }
@media (hover: none) { .fx-fadd { opacity: 1; } }

/* Lista de contatos do fluxo: uma linha por pessoa, último passo resumido (escala com muitos contatos). */
.fx-people li { padding: 6px; gap: 8px; }
.fx-people b { font-size: 13px; }
.fx-people .fx-step { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fx-people li > div { min-width: 0; }
.fx-people .btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* Modo livre horizontal: "+" à direita, linhas com traços correndo no sentido do fluxo. */
.fx-wires path.base { stroke-width: 2.5; opacity: .35; }
.fx-wires path.flow { stroke-width: 2.5; stroke-dasharray: 7 9; stroke-linecap: round; animation: fx-flow 1.1s linear infinite; }
@keyframes fx-flow { to { stroke-dashoffset: -32; } }
@media (prefers-reduced-motion: reduce) { .fx-wires path.flow { animation: none; } }
.fx-fadd.next { left: auto; right: -12px; top: 50%; bottom: auto; transform: translateY(-50%); }
.fx-fadd.yes { left: auto; right: -14px; top: 18%; bottom: auto; transform: translate(100%, -50%); }
.fx-fadd.no { left: auto; right: -14px; top: 82%; bottom: auto; transform: translate(100%, -50%); }
.fx-node.free:has(.fx-fadd.yes) .fx-fadd.next { right: auto; left: 50%; top: auto; bottom: -12px; transform: translateX(-50%); }

/* Modo JSON */
.fx-graph.json { display: block; padding: 24px; min-width: 0; transform: none !important; }
.fx-json { max-width: 980px; margin: 0 auto; display: grid; gap: 10px; }
.fx-json-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fx-json-head b { display: block; font-size: 14px; }
.fx-json-head small { display: block; font-size: 12px; color: var(--ink-3); }
.fx-json-actions { display: flex; gap: 8px; }
.fx-json-text { min-height: 60vh; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; tab-size: 2; resize: vertical; }
.fx-json-msg { margin: 0; font-size: 12.5px; color: var(--ink-3); min-height: 18px; }
.fx-json-msg.ok { color: var(--t-ap-c); }
.fx-json-msg.bad { color: var(--t-ag-c); }
.fx-canvas:has(.fx-graph.json) .fx-zoom { display: none; }

/* Modo livre compacto (estilo ManyChat/n8n) */
.fx-node.free { width: 210px; padding: 8px 10px; gap: 9px; border-radius: 12px; grid-template-columns: 30px minmax(0, 1fr); }
.fx-node.free .fx-node-icon { width: 30px; height: 30px; border-radius: 9px; }
.fx-node.free .fx-node-icon svg { width: 16px; height: 16px; }
.fx-node.free .fx-node-body small { font-size: 9.5px; letter-spacing: .06em; }
.fx-node.free .fx-node-body b { font-size: 12.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fx-node.free .fx-node-body > span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.fx-node.free .fx-node-stats { bottom: -9px; right: 8px; }
.fx-node.free .fx-node-stats button { font-size: 9.5px; padding: 0 6px; }
/* Menu do botão direito do editor */
.fx-ctx { min-width: 250px; }
.fx-ctx .mm-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; }
.fx-ctx .mm-item svg { flex: none; color: var(--ink-3); }
.fx-ctx .mm-item span { flex: 1; }
.fx-ctx kbd, .fx-keys kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--ink-3); font: 600 10.5px var(--font); }
.fx-ctx hr { margin: 4px 0; border: 0; border-top: 1px solid var(--line-2); }
.fx-keys { width: min(460px, calc(100vw - 32px)); }
.fx-keys dl { margin: 0; display: grid; gap: 6px; }
.fx-keys dl div { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.fx-keys dt, .fx-keys dd { margin: 0; }
.fx-toast { position: fixed; left: 50%; bottom: 24px; z-index: 2000; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--surface); font: 600 12.5px var(--font); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.fx-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Editor: blocos quadrados, painel que abre/fecha, zoom e Organizar pequenos no canto */
.fx-work { transition: grid-template-columns .2s ease; }
.fx-work.closed { grid-template-columns: minmax(0, 1fr) 0; }
.fx-work.closed .fx-inspector { display: none; }
.fx-ins-head { position: relative; }
.fx-ins-close { position: absolute; top: 10px; right: 10px; }
.fx-node.free { width: 168px; min-height: 120px; padding: 12px 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border-radius: 14px; }
.fx-node.free .fx-node-icon { width: 32px; height: 32px; }
.fx-node.free .fx-node-body { display: grid; gap: 2px; min-width: 0; width: 100%; }
.fx-node.free .fx-node-body > span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fx-free.v .fx-fadd.next { left: 50%; right: auto; top: auto; bottom: -12px; transform: translateX(-50%); }
.fx-free.v .fx-fadd.yes { left: 6px; right: auto; top: auto; bottom: -12px; transform: none; }
.fx-free.v .fx-fadd.no { right: 6px; left: auto; top: auto; bottom: -12px; transform: none; }
.fx-free.v .fx-node.free:has(.fx-fadd.yes) .fx-fadd.next { bottom: -36px; }
.fx-zoom { margin: -44px 0 0 10px; left: 10px; bottom: 10px; border-radius: 8px; }
.fx-zoom button { min-width: 28px; height: 28px; font-size: 11.5px; }
.fx-zoom .fx-arrange { padding: 0 10px; border-left: 1px solid var(--line); }

.ct-dups { border: 1px solid color-mix(in srgb, var(--t-pe-c) 40%, var(--line)); background: color-mix(in srgb, var(--t-pe-c) 7%, var(--surface)); border-radius: 12px; padding: 12px 14px; }
.ct-dup { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.ct-dup b { display: block; font-size: 13px; }
.ct-dup small { display: block; font-size: 11.5px; color: var(--ink-3); }

/* Conversa aberta: o botão "Dúvidas?" some para não cobrir o campo de escrever (se o painel já estiver aberto, continua). */
body.inbox:has(.chat-head:not([hidden])) .helpbot:not(.open), body:has(.in-chat) .helpbot:not(.open) { display: none; }

/* Editor: seletor de visão em ícones; vertical com cartões deitados e painel fixo */
.fx-views button { width: 36px; padding: 0; justify-content: center; }
.fx-views button svg { display: block; }
.fx-work.vmode .fx-ins-close { display: none; }
.fx-free.v .fx-node.free { width: 264px; min-height: 76px; flex-direction: row; align-items: center; gap: 11px; padding: 10px 14px; }
.fx-free.v .fx-node.free .fx-node-icon { flex: none; }
.fx-free.v .fx-node.free .fx-node-body > span { -webkit-line-clamp: 1; }
.fx-free.v .fx-node.free .fx-node-stats { right: 10px; bottom: -10px; }
/* JSON com cara de editor de código */
.fx-json { max-width: 1000px; margin: 0 auto; padding: 8px 4px 40px; display: grid; gap: 14px; }
.fx-json-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.fx-json-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fx-json-title b { display: block; font-size: 14.5px; }
.fx-json-title small { display: block; font-size: 12px; color: var(--ink-3); max-width: 520px; }
.fx-json-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand-ink, var(--brand)); font: 700 13px ui-monospace, Menlo, monospace; }
.fx-json-actions { display: flex; gap: 8px; }
.fx-json-actions .btn { gap: 6px; }
.fx-json-ed { border-radius: 14px; overflow: hidden; background: #0f1720; border: 1px solid #1f2a36; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .45); }
.fx-json-top { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 14px; background: #141e29; border-bottom: 1px solid #1f2a36; color: #8a9aab; font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.fx-json-top .dots { display: inline-flex; gap: 6px; }
.fx-json-top .dots i { width: 10px; height: 10px; border-radius: 50%; background: #2b3846; }
.fx-json-top .dots i:first-child { background: #ff5f57; } .fx-json-top .dots i:nth-child(2) { background: #febc2e; } .fx-json-top .dots i:last-child { background: #28c840; }
.fx-json-file { color: #c7d2dd; }
.fx-json-info { margin-left: auto; }
.fx-json-scroll { display: grid; grid-template-columns: auto minmax(0, 1fr); max-height: 62vh; overflow: auto; }
.fx-json-gut, .fx-json-hl, .fx-json-area textarea { margin: 0; padding: 14px 16px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; white-space: pre; }
.fx-json-gut { position: sticky; left: 0; z-index: 1; padding-right: 12px; text-align: right; color: #4c5d70; background: #0f1720; border-right: 1px solid #1f2a36; user-select: none; }
.fx-json-area { position: relative; min-width: 0; }
.fx-json-hl { color: #c7d2dd; pointer-events: none; min-height: 100%; }
.fx-json-hl i { font-style: normal; }
.fx-json-hl .k { color: #7cc4ff; } .fx-json-hl .s { color: #a5e3a1; } .fx-json-hl .n { color: #f5b971; } .fx-json-hl .l { color: #d8a4ff; }
.fx-json-area textarea { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: #fff; }
.fx-json-area textarea::selection { background: rgba(124, 196, 255, .28); color: transparent; }
.fx-json-msg { margin: 0; padding: 8px 16px; min-height: 0; font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: #8a9aab; background: #141e29; border-top: 1px solid #1f2a36; }
.fx-json-msg.ok { color: #6ee7a8; } .fx-json-msg.bad { color: #ff8a8a; }
.fx-json-scroll { grid-template-columns: auto 1fr; }
.fx-json-area { width: max-content; min-width: 100%; }

.fx-held { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin-top: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--t-pe-c); background: color-mix(in srgb, var(--t-pe-c) 12%, transparent); cursor: pointer; }
.row-line { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700; color: #7c3aed; background: color-mix(in srgb, #7c3aed 12%, transparent); }

.await-strip { display: flex; align-items: center; gap: 6px; margin: 4px 8px 6px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--t-pe-c); background: color-mix(in srgb, var(--t-pe-c) 10%, var(--surface)); text-decoration: none; }
.await-strip span { margin-left: auto; font-weight: 600; }
.await-mestre { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--t-pe-c); background: color-mix(in srgb, var(--t-pe-c) 12%, transparent); }

.mestres-reg { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 6px; }
.mestres-reg .input { width: 170px; height: 32px; }
.mestres-reg small { flex-basis: 100%; }
.viewas-bar.acting { background: #c2410c; color: #fff; }
.viewas-bar button { white-space: nowrap; }

/* Coordenador: Ativas e Encaminhadas */
.arch-tabs { display: flex; gap: 4px; margin: 0 12px 8px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.arch-tabs button { flex: 1; height: 30px; border: 0; border-radius: 8px; background: none; font: 600 12.5px var(--font); color: var(--ink-2); cursor: pointer; }
.arch-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.arch-empty { padding: 24px 16px; text-align: center; }
body.conv-ro #handoff { display: none !important; }
.contact-owner-readonly { margin-top: 6px; font-size: 13px; color: var(--ink); }
body.conv-ro #info-body :is(.agent-card, #stage-pick),
body.conv-reply-locked #info-body :is(.rc-send, #contact-note, [data-save-note]) { pointer-events: none; opacity: .5; }
body.conv-ro #cafe-quick { display: none; }
body.conv-reply-locked #msgs :is(.msg-more, .msg-act, [data-transcribe]) { display: none; }
.msg .msg-cta { display: block; border-top: 1px solid var(--line); margin-top: 6px; padding: 7px 0 2px; color: var(--brand-ink); font-weight: 600; text-align: center; text-decoration: none; }
.msg a.msg-cta:hover { text-decoration: underline; }
.ro-closed { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 auto 14px; padding: 10px 16px; max-width: 640px; border-radius: 12px; font-size: 12.5px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.ro-closed .i { flex: none; color: var(--t-ap-c); }

.arch-unread { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: 999px; font: 700 10.5px var(--font); font-style: normal; color: #fff; background: #4C8DFF; vertical-align: 1px; }
.arch-unread[hidden] { display: none; }

/* Link do grupo redefinido (faixa na lista) e tela Link do grupo */
.grp-alert { display: grid; gap: 4px; margin: 4px 8px 6px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; color: var(--text); background: color-mix(in srgb, #4C8DFF 10%, var(--surface)); border: 1px solid color-mix(in srgb, #4C8DFF 35%, transparent); }
.grp-alert small { color: var(--muted); }
.grp-alert div { display: flex; gap: 6px; margin-top: 4px; }
.grp-alert .input { flex: 1; min-width: 0; height: 34px; font-size: 13px; }
.grp-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.grp-state.ok { color: #22D3EE; } .grp-state.broken { color: #4C8DFF; } .grp-state.unknown { color: var(--muted); }
.grp-link { word-break: break-all; font-size: 13px; }

/* Humor do cliente como ícone no cabeçalho do resumo (detalhes só aberto) */
.inbox-brief summary .brief-mood { margin-left: auto; padding: 0 8px; gap: 5px; font-size: 11.5px; cursor: help; }
.inbox-brief summary .brief-mood svg { flex: none; opacity: .85; }
.inbox-brief #inbox-brief-text { white-space: pre-line; }
.inbox-brief summary:has(.brief-mood:not([hidden]))::after { margin-left: 6px; }
.chip.tag.t-encerrado { background: color-mix(in srgb, #8a94a0 16%, transparent); color: var(--ink-2); }
/* Humor no resumo fechado: mesmo formato da tag IA (borda, tamanho), sólida na cor do humor */
.inbox-brief summary .chip.humor.brief-mood { height: auto; gap: 4px; padding: 1px 6px; border-radius: 4px; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.5; color: #fff; background: var(--hc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hc) 70%, #000); }
.inbox-brief summary .chip.humor.brief-mood svg { width: 10px; height: 10px; opacity: 1; }
@media (max-width: 760px) { .inbox-brief summary .chip.humor.brief-mood { font-size: 10px; } }

/* Cabeçalho da conversa enxuto: nome do lead sempre visível, tags menores */
.chat-head .head-main { min-width: 150px; flex: 1 1 auto; }
.chat-head .chip, .chat-head .head-channel { height: 20px; padding: 0 7px; gap: 4px; font-size: 11px; }
.chat-head .agent-chip { height: 24px; padding: 0 9px 0 7px; gap: 5px; font-size: 11px; }
.chat-head .cafe-quick { height: 26px; padding: 0 9px; font-size: 11.5px; }
@media (max-width: 1400px) { .chat-head .cafe-quick span, .chat-head .agent-chip .ag-label { display: none; } .chat-head .cafe-quick, .chat-head .agent-chip { padding: 0 7px; } }

/* Janela de 24 h: quando fecha */
.window-timer { display: flex; align-items: center; gap: 6px; margin: 0 12px 4px; padding: 4px 10px; border-radius: 8px; font-size: 12px; color: var(--ink-3); background: color-mix(in srgb, var(--brand, #22D3EE) 8%, transparent); }
.window-timer .i, .window-timer svg { width: 13px; height: 13px; flex: none; }
.window-timer b { font-weight: 600; color: var(--ink-2); }
.window-timer.soon { color: #b45309; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.window-timer.soon b { color: #b45309; }
.head-channel.switch { cursor: pointer; } .head-channel.switch:hover { filter: brightness(.95); text-decoration: underline; }

/* Classificador de IA: teste com conversa real */
.fx-ai-test-row { display: flex; gap: 6px; } .fx-ai-test-row .input { flex: 1; min-width: 0; }
.fx-ai-result { margin: 6px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; background: var(--surface-2); }
.fx-ai-result.yes { box-shadow: inset 3px 0 0 #22D3EE; } .fx-ai-result.no { box-shadow: inset 3px 0 0 #d99a06; }

/* Escolha da IA do bloco (logotipos reais) */
.fx-ai-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fx-ai-opt { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.fx-ai-opt small { font-size: 9.5px; font-weight: 500; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-ai-opt.on { border-color: var(--brand, #22D3EE); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand, #22D3EE) 25%, transparent); color: var(--ink); }
.fx-ai-opt:disabled { opacity: .45; cursor: not-allowed; }
.fx-ai-result svg { vertical-align: -3px; margin-right: 5px; }

.window-timer.flow-soon { color: var(--ai-soft-ink, #5b4bd6); background: color-mix(in srgb, #7c3aed 10%, transparent); }
.window-timer.flow-soon b { color: inherit; }
.kv .kv-soon dd { color: #b45309; font-weight: 600; }
.head-channel .ch-swap { display: inline-flex; align-items: center; flex: none; opacity: .85; }

/* Etiqueta manual da conversa: seletor compacto no estilo das etiquetas do WhatsApp. */
.tag-menu-wrap { position: relative; }
.head-tag-trigger { position: relative; display: inline-flex; align-items: center; border: 0; padding: 0; border-radius: 999px; background: none; cursor: pointer; }
.head-tag-trigger:hover { filter: brightness(1.1); }
.tag-caret { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); color: inherit; opacity: .65; pointer-events: none; transition: transform .15s; }
.head-tag-trigger[aria-expanded="true"] .tag-caret { transform: translateY(-50%) rotate(180deg); }
.tag-menu { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: 230px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.tag-menu[hidden] { display: none; }
.tag-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: 12px; cursor: pointer; }
.tag-menu button:hover, .tag-menu button.selected { background: var(--hover); }
.tag-menu button > span:nth-child(2) { flex: 1; }
.tag-menu button b { display: block; font-weight: 600; }
.tag-menu button small { display: block; margin-top: 2px; color: var(--ink-3); font-size: 10px; }
.tag-menu button i { color: var(--brand); font-style: normal; font-weight: 700; }
.tag-menu-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.tag-menu-dot.t-aguardando { background: var(--t-ag-c); }
.tag-menu-dot.t-pendente { background: var(--t-pe-c); }
.tag-menu-dot.t-agendado { background: var(--t-ca-c); }
.tag-menu-dot.t-aprovado { background: var(--t-ap-c); }

/* Mesma altura para os controles do cabeçalho e as etiquetas do resumo. */
body.inbox { --conversation-chip-height: 20px; }
.chat-head .chip,
.chat-head #head-tag .chip,
.chat-head .cafe-quick,
.chat-head #info-btn,
.inbox-brief .brief-badge,
.inbox-brief summary .chip.humor.brief-mood {
    height: var(--conversation-chip-height);
    box-sizing: border-box;
    flex-shrink: 0;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
}
.chat-head #head-tag .chip { padding: 0 8px; }
.chat-head #head-tag .head-tag-trigger .chip { padding-right: 25px; }
.head-tag-trigger { color: var(--ink-2); }
.chat-head .head-channel { border: 0; font-family: inherit; }
.chat-head .head-channel:disabled { cursor: default; opacity: 1; }
.chat-head .head-channel.switch:hover { text-decoration: none; filter: brightness(1.12); }
.chat-head .cafe-quick { width: auto; padding: 0 7px; }
.chat-head .cafe-quick .i { width: 13px; height: 13px; }
.chat-head #info-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    padding: 0 6px 0 7px;
    background: var(--brand-soft);
    color: var(--brand-ink);
}
.chat-head #info-btn .i { width: 14px; height: 14px; }
.chat-head #info-btn .ct-lbl { font-size: 12.5px; font-weight: 600; line-height: 1; }
.chat-head #info-btn { padding: 0 9px 0 8px; gap: 5px; }
.chat-head #info-btn.on { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
@media (min-width: 1280px) {
    .show-info .chat-head #info-btn::after {
        content: "";
        position: absolute;
        left: 100%;
        top: 50%;
        width: 10px;
        height: 1px;
        background: color-mix(in srgb, var(--brand) 45%, var(--line));
    }
}
.inbox-brief .brief-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    border: 1px solid transparent;
    color: var(--ink-2);
    background: linear-gradient(var(--surface), var(--surface)) padding-box,
        conic-gradient(from var(--ang), var(--ai-1), var(--ai-2), var(--ai-3), var(--ai-1)) border-box;
    box-shadow: none;
    font-weight: 600;
    letter-spacing: .02em;
    animation: spinGrad 8s linear infinite;
}
.brief-orb {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ai-grad);
    animation: briefPulse 3s ease-in-out infinite;
}
.inbox-brief summary .chip.humor.brief-mood { padding: 0 7px; font-size: 9.5px; font-weight: 600; }
@keyframes briefPulse { 50% { opacity: .55; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) {
    .inbox-brief .brief-badge, .brief-orb { animation: none; }
    .tag-caret { transition: none; }
}
@media (max-width: 760px) {
    .chat-head .head-main { min-width: 0; }
}

/* Pesquisar dentro da conversa (como no WhatsApp) */
.find-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 14px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); z-index: 2; }
.find-bar[hidden] { display: none; }
.find-bar input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 17px; padding: 0 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; outline: none; }
.find-bar input:focus { border-color: var(--brand); }
.find-count { font-size: 12.5px; white-space: nowrap; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.find-bar .icon-btn:disabled { opacity: .35; }
mark.find-hit { background: #ffe066; color: #1a1a1a; border-radius: 3px; padding: 0 1px; }
mark.find-hit.cur { background: #ff9f1a; box-shadow: 0 0 0 2px #ff9f1a; }
.chat-head #find-btn.on { color: var(--brand); background: var(--brand-soft); }

/* Celular: tabelas com ações viram cartões (ações sempre visíveis, sem arrastar para o lado). */
@media (max-width: 760px) {
    .table-wrap:has(> .m-cards), .tp-table-scroll:has(> .m-cards) { overflow: visible; }
    table.m-cards, .m-cards tbody { display: block; min-width: 0 !important; width: 100%; }
    .m-cards thead { display: none; }
    .m-cards tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .m-cards tbody td { display: block; min-width: 0; padding: 0 !important; border: 0 !important; grid-column: 1 / -1; font-size: 12.5px; text-align: left; }
    .m-cards tbody td:first-child { grid-column: 1; grid-row: 1; font-size: 14px; }
    .m-cards tbody td:last-child { grid-column: 2; grid-row: 1; white-space: nowrap; display: flex; gap: 4px; align-items: center; }
    .m-cards td:empty { display: none; }
    .team-tbl .person { min-width: 0; gap: 10px; }
    .team-tbl .person > div { min-width: 0; }
    .team-tbl .person b, .team-tbl .person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-tbl .person small { font-size: 11.5px; }
    .team-tbl tbody tr { grid-template-columns: 42px auto auto minmax(0, 1fr) auto; gap: 4px 6px; padding: 10px 8px 10px 14px; cursor: pointer; }
    .team-tbl tbody tr:active { background: var(--row-hover); }
    .team-tbl tbody td:first-child { grid-column: 1 / 5; }
    .team-tbl tbody td:last-child { grid-column: 5; grid-row: 1 / 3; align-self: center; }
    .team-tbl tbody td:nth-child(2) { grid-column: 2; grid-row: 2; }
    .team-tbl tbody td:nth-child(4) { grid-column: 3; grid-row: 2; }
    .team-tbl tbody td:nth-child(3) { grid-column: 4; grid-row: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .team-tbl tbody td:nth-child(5) { display: none; }
    .team-tbl tbody td .chip { font-size: 11px; padding: 1px 7px; }
    .team-tbl tbody td .status { font-size: 11.5px; }
    .m-cards .team-actions > form { display: flex; }
    .m-cards .team-actions .icon-btn { width: 38px; height: 38px; }
}
.team-row { cursor: pointer; }
.access-box { border-top: 1px solid var(--line); padding-top: 14px; }
.access-box p { margin: 2px 0 8px; font-weight: 400; }
.access-box .btn[hidden] { display: none; }

/* Arrastar para baixo e atualizar (app instalado) */
.ptr { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; z-index: 9999; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--muted); box-shadow: 0 2px 10px rgba(0,0,0,.25); opacity: 0; transform: translate(-50%, -44px); pointer-events: none; }
.ptr.ready { color: var(--brand); }
.ptr.spin svg { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* Celular: cabeçalho da conversa em 2 linhas. Nome e telefone do lead com espaço; etiqueta e número embaixo. */
@media (max-width: 600px) {
    .chat-head { display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto auto auto; grid-template-rows: auto auto; align-items: center; column-gap: 4px; row-gap: 2px; height: auto !important; min-height: 60px; padding: 6px 6px 6px 2px !important; }
    .chat-head #back { grid-column: 1; grid-row: 1 / 3; }
    .chat-head .head-main { grid-column: 2 / 4; grid-row: 1; min-width: 0 !important; }
    .chat-head #find-btn { grid-column: 4; grid-row: 1; }
    .chat-head #info-btn { grid-column: 5; grid-row: 1; }
    .chat-head #head-tag { grid-column: 2; grid-row: 2; justify-self: start; display: inline-flex !important; margin-left: 50px; }
    .chat-head #head-channel:not([hidden]) { grid-column: 3 / 6; grid-row: 2; justify-self: end; display: inline-flex !important; }
    .chat-head #cafe-quick { grid-column: 3; grid-row: 2; justify-self: end; height: 26px; width: 30px; }
    .chat-head #head-channel:not([hidden]) ~ #cafe-quick { margin-right: 36px; }
    .chat-head #head-tag .chip, .chat-head #head-channel { height: 22px !important; font-size: 11px; }
    .chat-head #info-btn .ct-lbl { display: none; }
    .chat-head #info-btn { padding: 0 8px; }
}

/* Admin: o Mestre responsável aparece em destaque (dourado) na lista; coordenador continua cinza. */
.row-meta3 .row-master.is-mestre { flex: none; max-width: 48%; height: 18px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, #d4a017 16%, transparent); color: color-mix(in srgb, #d4a017 85%, var(--ink)); font-weight: 600; }
.row-meta3 .row-master.is-mestre .i { stroke-width: 2.4; }

/* Secretaria (conexão por QR) */
.sec-conn #sec-qr-img { display: block; width: 260px; height: 260px; margin: 10px 0; border-radius: 12px; background: #fff; padding: 8px; }
.sec-steps { margin: 6px 0 4px 18px; padding: 0; line-height: 1.6; }

/* ==========================================================================
   Identidade Shark (16/11/2026): grafite profundo com neon: ciano, violeta, magenta e um toque âmbar.
   Azul-elétrico só para IA e brilho de "reator". Tema escuro é o padrão (layout.php
   marca data-theme="dark" quando ninguém escolheu); o claro é opcional pelo menu.
   Display técnica Rajdhani nos títulos; Inter no corpo. HUD com moderação.
   ========================================================================== */
:root {
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    --font-display: Rajdhani, "Space Grotesk", Inter, system-ui, sans-serif;
    --gold: #22D3EE; --gold-2: #A78BFA; --gold-soft: rgba(34, 211, 238, .14); --neon-grad: linear-gradient(110deg, #22D3EE, #6366F1 40%, #A855F7 70%, #F43F8E);
    --blue-1: #4C8DFF; --blue-2: #1F5FE0; --blue-3: #0E2F7A;
    --reactor: #38BDF8; --reactor-2: #2F7BFF;
    --chamfer: 10px;
    /* Claro (opcional) */
    --bg: #EEEFF1; --surface: #FFFFFF; --surface-2: #F1F2F4; --surface-3: #F7F7F8; --hover: #F2F3F5;
    --line: #DEE0E4; --line-2: #ECEDF0; --ink: #15171B; --ink-2: #555B64; --ink-3: #868C95;
    --brand: #6D3AED; --brand-ink: #5B21B6; --brand-soft: #EFE9FE; --on-brand: #FFFFFF;
    --rail: #050C0A; --rail-ink: #858B94;
    --wa-bg: #ECECEE; --wa-in: #FFFFFF; --wa-out: #F4EBDD; --wa-author: #5B21B6; --tick: #2F7BFF;
    --brand-grad: linear-gradient(120deg, #22D3EE 0%, #6366F1 40%, #A855F7 75%, #F43F8E 100%);
    --glow: 0 1px 3px rgba(21, 23, 27, .18), 0 4px 12px rgba(124, 58, 237, .18);
    --ai-1: #2F7BFF; --ai-2: #38BDF8; --ai-3: #7DD3FC; --ai-soft-ink: #1D4ED8;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #070F0C; --surface: #0E1714; --surface-2: #16211D; --surface-3: #111B18; --hover: #18241F;
    --line: #1F2D28; --line-2: #18241F; --ink: #E7EEEA; --ink-2: #A9B7B0; --ink-3: #74867E;
    --brand: #7C3AED; --brand-ink: #C4B5FD; --brand-soft: rgba(139, 92, 246, .2); --on-brand: #FFFFFF;
    --rail: #050C0A; --rail-ink: #7E968C;
    --wa-bg: #070F0C; --wa-in: #16211D; --wa-out: #2B1D5E; --wa-author: #67E8F9; --wa-meta: #9AA1AA;
    --composer: #0E1714; --composer-field: #16211D;
    --brand-grad: linear-gradient(120deg, #22D3EE 0%, #6366F1 40%, #A855F7 75%, #F43F8E 100%);
    --glow: 0 0 0 1px rgba(139, 92, 246, .35), 0 0 28px -6px rgba(168, 85, 247, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 36px -12px rgba(0, 0, 0, .65);
    --ai-soft-ink: #7DD3FC; --av-s: 14%;
    --row-sel: #2a3942; --row-hover: #202c33;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #070F0C; --surface: #0E1714; --surface-2: #16211D; --surface-3: #111B18; --hover: #18241F;
        --line: #1F2D28; --line-2: #18241F; --ink: #E7EEEA; --ink-2: #A9B7B0; --ink-3: #74867E;
        --brand: #7C3AED; --brand-ink: #C4B5FD; --brand-soft: rgba(139, 92, 246, .2); --on-brand: #FFFFFF;
        --rail: #050C0A; --rail-ink: #7E968C;
        --wa-bg: #070F0C; --wa-in: #16211D; --wa-out: #2B1D5E; --wa-author: #67E8F9; --wa-meta: #9AA1AA;
        --composer: #0E1714; --composer-field: #16211D;
        --brand-grad: linear-gradient(120deg, #22D3EE 0%, #6366F1 40%, #A855F7 75%, #F43F8E 100%);
        --glow: 0 0 0 1px rgba(139, 92, 246, .35), 0 0 28px -6px rgba(168, 85, 247, .6);
        --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 36px -12px rgba(0, 0, 0, .65);
        --ai-soft-ink: #7DD3FC; --av-s: 14%;
        --row-sel: #2a3942; --row-hover: #202c33;
    }
}

/* Tipografia técnica nos títulos (Rajdhani pede um pouco mais de corpo e caixa) */
h1, h2, h3, .view-head h1, .pane-head h1, .card-head h2, .crm-dialog h2, .kpi b, .fx-name, .ld h1, .ld h2, .ld-brand {
    font-family: var(--font-display); font-weight: 700; letter-spacing: .01em;
}
.view-head h1, .pane-head h1 { font-size: 1.55em; text-transform: none; }
.kpi b { letter-spacing: .02em; }

/* Menu lateral: marca no topo, item ativo em dourado com traço de HUD */
.rail { background: linear-gradient(180deg, #0E0F12, var(--rail)); box-shadow: inset -1px 0 0 rgba(34, 211, 238, .12); }
@media (min-width: 861px) {
    .rail-items .brand-home, .rail-items .brand-home.on { background: url(icons/shark.svg) center / 100% no-repeat; box-shadow: 0 6px 18px rgba(139, 92, 246, .35); border-radius: 0; }
    .rail-items .brand-home > svg, .rail-items .brand-home > .i { opacity: 0; }
}
.rail-items a.on:not(.brand-home) { color: var(--gold-2); background: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .22); }
.rail-items a.on:not(.brand-home)::before { background: var(--gold-2); box-shadow: 0 0 10px rgba(34, 211, 238, .6); }

/* HUD com moderação: cantos chanfrados nos botões principais, filete dourado nos cartões, brilho no foco */
.btn.primary, .btn-primary, button.primary, .composer > .send {
    background: var(--brand-grad) !important; color: #fff !important; border-radius: 4px;
    clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer));
}
.composer > .send { --chamfer: 8px; border-radius: 6px !important; }
.card { position: relative; }
.card::after { content: ""; position: absolute; top: -1px; left: 14px; width: 42px; height: 2px; border-radius: 0 0 2px 2px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .7; pointer-events: none; }
:focus-visible { outline: 1.5px solid var(--reactor); outline-offset: 2px; box-shadow: 0 0 0 4px rgba(56, 189, 248, .18); }
.input:focus, input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: color-mix(in srgb, var(--reactor) 70%, var(--line)); box-shadow: 0 0 0 3px rgba(56, 189, 248, .16); }
.count { background: var(--brand); }

/* Tela de entrada: grafite com grade de engenharia, acesso com borda metálica */
body.landing { --l-bg: #08090B; --l-brand: #4C8DFF; --l-ai: #38BDF8; }
.ld-mark { background: none !important; box-shadow: none !important; border-radius: 0; }
.ld-mark img { display: block; width: 100%; height: 100%; }
.ld-login { border-radius: 6px; clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px); }
.ld-login::before { border-radius: 6px; }
.ld-login button[type="submit"] { border-radius: 4px; background: var(--brand-grad); box-shadow: 0 12px 30px rgba(139, 92, 246, .35), inset 0 1px 0 rgba(255, 255, 255, .25); color: #fff;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.ld-login input { border-radius: 4px; }
.ld-login input:focus { border-color: rgba(56, 189, 248, .7); box-shadow: 0 0 0 3px rgba(56, 189, 248, .18); }
