:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef2f4;
  --border: #e2e7ec;
  --border-strong: #cfd7de;
  --text: #0e1a24;
  --text-2: #4d5d6c;
  --muted: #7d8b98;
  --brand: #0a8f63;
  --brand-hover: #087752;
  --brand-soft: #e2f4ec;
  --brand-text: #076a49;
  --on-brand: #ffffff;
  --side-bg: #0c1a22;
  --side-text: #c4d1da;
  --side-muted: #7f939f;
  --side-active: #16303b;
  --warning: #a86b00;
  --warning-soft: #fdf1d8;
  --danger: #c43d35;
  --danger-soft: #fde6e4;
  --info: #2a62c9;
  --info-soft: #e3ecfb;
  --bubble-in: #ffffff;
  --bubble-out: #d8f8d0;
  --bubble-bot: #e8f1fd;
  --chat-bg: #efeae2;
  --shadow: 0 1px 2px rgba(14, 26, 36, .06), 0 2px 8px rgba(14, 26, 36, .04);
  --shadow-lg: 0 12px 40px rgba(14, 26, 36, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1116; --surface: #111b22; --surface-2: #15212a; --surface-3: #1b2832;
    --border: #22323e; --border-strong: #2e414e; --text: #e5edf2; --text-2: #a3b3bf; --muted: #7a8c99;
    --brand: #1fbf86; --brand-hover: #34d398; --brand-soft: #123a2d; --brand-text: #5fe0ae; --on-brand: #04140d;
    --side-bg: #070d11; --side-active: #13252e;
    --warning: #f0b33e; --warning-soft: #3a2d10; --danger: #f07a72; --danger-soft: #3d1c1a; --info: #78a6f5; --info-soft: #182a47;
    --bubble-in: #1c2a33; --bubble-out: #11463a; --bubble-bot: #182c45; --chat-bg: #0d161c;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1116; --surface: #111b22; --surface-2: #15212a; --surface-3: #1b2832;
  --border: #22323e; --border-strong: #2e414e; --text: #e5edf2; --text-2: #a3b3bf; --muted: #7a8c99;
  --brand: #1fbf86; --brand-hover: #34d398; --brand-soft: #123a2d; --brand-text: #5fe0ae; --on-brand: #04140d;
  --side-bg: #070d11; --side-active: #13252e;
  --warning: #f0b33e; --warning-soft: #3a2d10; --danger: #f07a72; --danger-soft: #3d1c1a; --info: #78a6f5; --info-soft: #182a47;
  --bubble-in: #1c2a33; --bubble-out: #11463a; --bubble-bot: #182c45; --chat-bg: #0d161c;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand-text); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--logo-bg, linear-gradient(135deg, #1fbf86, #0a8f63)); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 20px; height: 20px; stroke: #fff; }
.logo b { display: block; font-size: 15px; }
.logo span { font-size: 12px; color: var(--side-muted); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--side-text); text-decoration: none; font-weight: 500; position: relative; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.ativo { background: var(--side-active); color: #fff; }
.nav-item.ativo::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent, #1fbf86); }
.nav-badge { margin-left: auto; background: var(--side-accent, #1fbf86); color: #0b0b0b; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav-badge.alerta { background: #f0b33e; }
.side-sep { height: 1px; background: rgba(255,255,255,.07); margin: 10px 4px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; font-size: 12px; color: var(--side-muted); }
/* quem entrou (login por pessoa) */
.side-eu { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 6px; }
.side-eu + .side-foot { margin-top: 0; padding-top: 6px; }
.side-eu-nome { display: flex; align-items: center; gap: 8px; color: var(--side-text); min-width: 0; }
.side-eu-nome span { display: flex; flex-direction: column; min-width: 0; }
.side-eu-nome b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-eu-nome small { font-size: 11px; color: var(--side-muted); }
.side-eu-acoes { display: flex; gap: 4px; flex-wrap: wrap; }
.side-eu-acoes .btn { color: var(--side-muted); padding: 4px 8px; }
.side-eu-acoes .btn:hover { color: var(--side-text); }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: 60px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.topbar .espaco { flex: 1; }
.conteudo { flex: 1; overflow-y: auto; padding: 24px; }
.conteudo.cheio { padding: 0; overflow: hidden; }
.pagina { max-width: 1240px; margin: 0 auto; }

/* ---------------------------------------------------------------- componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-h .acoes { margin-left: auto; display: flex; gap: 8px; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-32 { grid-template-columns: 1.7fr 1fr; }
@media (max-width: 1000px) { .g-2, .g-32 { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }

.btn { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primario:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.perigo { color: var(--danger); }
.btn.perigo:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.fantasma { border-color: transparent; background: transparent; }
.btn.fantasma:hover { background: var(--surface-3); }
.btn.peq { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icone { width: 36px; padding: 0; }
.btn.peq.icone { width: 30px; }

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo > label, .rotulo { font-size: 13px; font-weight: 600; color: var(--text-2); }
.campo .ajuda { font-size: 12px; color: var(--muted); }
.input, textarea.input, select.input { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.45; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.linha { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.linha > .campo { flex: 1; min-width: 160px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 550; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .trilho { width: 40px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .trilho::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .trilho { background: var(--brand); }
.switch input:checked + .trilho::after { transform: translateX(18px); }
.switch input:focus-visible + .trilho { box-shadow: 0 0 0 3px var(--brand-soft); }

.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--brand); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--brand-soft); color: var(--brand-text); }
.badge.aviso { background: var(--warning-soft); color: var(--warning); }
.badge.erro { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge .ponto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ponto.pulsa { animation: pulsa 1.6s infinite; }
@keyframes pulsa { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.tag button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); line-height: 1; }

.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: 13px; text-decoration: none; color: var(--text); }
.status-pill .ponto { width: 8px; height: 8px; border-radius: 50%; }

.vazio { text-align: center; padding: 40px 20px; color: var(--muted); }
.vazio svg.i { width: 36px; height: 36px; stroke-width: 1.5; margin-bottom: 8px; }

.tabela { width: 100%; border-collapse: collapse; }
.tabela th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; }
.tabela td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tr:hover td { background: var(--surface-2); }
.tabela-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; color: #fff; }
.avatar.peq { width: 32px; height: 32px; font-size: 12px; }
.avatar.gde { width: 72px; height: 72px; font-size: 24px; }

.toast-area { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { min-width: 280px; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow-lg); animation: entra .2s ease-out; cursor: pointer; }
.toast.aviso { border-left-color: var(--warning); }
.toast.erro { border-left-color: var(--danger); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes entra { from { transform: translateY(10px); opacity: 0; } }

dialog.modal { border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(5, 12, 16, .55); }
.modal-h { display: flex; align-items: center; padding: 18px 20px 4px; }
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-b { padding: 12px 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 18px; }

/* ---------------------------------------------------------------- dashboard */
.kpi { padding: 16px 18px; }
.kpi .rotulo { display: flex; align-items: center; gap: 8px; font-weight: 550; color: var(--text-2); font-size: 13px; }
.kpi .rotulo svg { color: var(--muted); width: 16px; height: 16px; }
.kpi .valor { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--muted); }
.kpi .delta b { color: var(--text-2); }
.kpi.destaque { background: var(--warning-soft); border-color: transparent; }
.kpi.destaque .valor { color: var(--warning); }

.grafico { position: relative; }
.grafico svg { display: block; width: 100%; overflow: visible; }
.grafico .eixo { fill: var(--muted); font-size: 11px; }
.grafico .grade { stroke: var(--border); stroke-width: 1; }
.grafico .barra { fill: var(--brand); transition: opacity .1s; }
.grafico .barra.hoje { fill: var(--brand-hover); }
.grafico .alvo { fill: transparent; cursor: default; }
.grafico.hover .barra { opacity: .45; }
.grafico.hover .barra.ativa { opacity: 1; }
.dica { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 6px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; z-index: 5; box-shadow: var(--shadow-lg); }
.dica b { font-size: 13px; }

.fila-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.fila-item:last-child { border-bottom: 0; }
.fila-item .info { flex: 1; min-width: 0; }
.fila-item .info b { display: block; }
.fila-item .info span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- conversas */
.chat-app { display: grid; grid-template-columns: 340px 1fr 300px; height: 100%; }
.chat-app.sem-detalhes { grid-template-columns: 340px 1fr; }
@media (max-width: 1250px) { .chat-app, .chat-app.sem-detalhes { grid-template-columns: 300px 1fr; } .chat-detalhes { display: none; } }
.chat-lista { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-lista-h { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.busca { position: relative; }
.busca svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.busca input { padding-left: 34px; background: var(--surface-2); }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.filtro.ativo { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.chat-itens { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 12px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--border); align-items: center; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.ativo { background: var(--brand-soft); }
.chat-item .meio { flex: 1; min-width: 0; }
.chat-item .l1, .chat-item .l2 { display: flex; align-items: center; gap: 6px; }
.chat-item .l1 b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chat-item .l1 time { font-size: 11px; color: var(--muted); }
.chat-item .l2 span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.chat-item .nl { background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; }

.chat-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); }
.thread-h { height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.thread-h .nome { flex: 1; min-width: 0; }
.thread-h .nome b { display: block; font-size: 15px; }
.thread-h .nome span { font-size: 12px; color: var(--muted); }
.aviso-barra { padding: 9px 18px; font-size: 13px; display: flex; align-items: center; gap: 10px; background: var(--info-soft); color: var(--info); border-bottom: 1px solid var(--border); }
.aviso-barra.aguardando { background: var(--warning-soft); color: var(--warning); }
.aviso-barra .btn { margin-left: auto; }
.mensagens { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 4px; }
.dia-sep { align-self: center; background: var(--surface); color: var(--text-2); font-size: 12px; padding: 4px 12px; border-radius: 8px; margin: 10px 0; box-shadow: var(--shadow); }
.bolha { max-width: min(560px, 75%); padding: 7px 10px 6px; border-radius: 10px; background: var(--bubble-in); box-shadow: 0 1px 1px rgba(0,0,0,.08); align-self: flex-start; line-height: 1.42; word-wrap: break-word; white-space: pre-wrap; position: relative; }
.bolha.eu { align-self: flex-end; background: var(--bubble-out); }
.bolha.eu.bot { background: var(--bubble-bot); }
.bolha .autor { display: block; font-size: 11px; font-weight: 700; color: var(--brand-text); margin-bottom: 2px; }
.bolha.bot .autor { color: var(--info); }
.bolha .hora { float: right; margin: 6px 0 -4px 12px; font-size: 11px; color: var(--muted); }
.bolha img, .bolha video { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; margin-bottom: 4px; cursor: zoom-in; }
.bolha audio { width: 260px; max-width: 100%; }
.bolha code { font-family: Consolas, monospace; font-size: 13px; }
.compositor { flex: none; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--border); position: relative; }
.compositor .linha-c { display: flex; align-items: flex-end; gap: 8px; }
.compositor textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; border-radius: 10px; padding: 9px 12px; }
.anexo-chip { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 10px; background: var(--surface-3); border-radius: 8px; font-size: 13px; }
.rapidas { position: absolute; bottom: calc(100% - 4px); left: 14px; right: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; }
.rapidas div { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.rapidas div:last-child { border-bottom: 0; }
.rapidas div.sel, .rapidas div:hover { background: var(--brand-soft); }
.rapidas b { color: var(--brand-text); margin-right: 8px; }

.chat-detalhes { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 24px 18px; }
.chat-detalhes .topo { text-align: center; margin-bottom: 18px; }
.chat-detalhes .topo .avatar { margin: 0 auto 10px; }
.det-linha { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.det-linha span:first-child { color: var(--muted); }
.tags-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tags-edit input { border: 1px dashed var(--border-strong); background: transparent; border-radius: 6px; padding: 2px 8px; font-size: 12px; width: 110px; outline: none; }

/* ---------------------------------------------------------------- automação */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.aba { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.aba.ativa { color: var(--brand-text); border-bottom-color: var(--brand); }
.auto-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.auto-grid > * { min-width: 0; }
@media (max-width: 1100px) { .auto-grid { grid-template-columns: 1fr; } }
.item-edit { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.item-edit .topo { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.item-edit .num { width: 56px; text-align: center; font-weight: 700; }
.dias { display: flex; gap: 6px; flex-wrap: wrap; }
.dias label { cursor: pointer; }
.dias input { display: none; }
.dias span { display: inline-block; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border-strong); font-weight: 600; font-size: 13px; }
.dias input:checked + span { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.vars { display: flex; gap: 6px; flex-wrap: wrap; }
.vars button { border: 1px dashed var(--border-strong); background: var(--surface); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; font-family: Consolas, monospace; color: var(--brand-text); }
.barra-salvar { position: sticky; bottom: 0; margin: 20px -24px -24px; padding: 14px 24px; background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; justify-content: flex-end; z-index: 4; }

.celular { position: sticky; top: 0; border-radius: 26px; border: 8px solid #1c262d; overflow: hidden; box-shadow: var(--shadow-lg); background: var(--chat-bg); display: flex; flex-direction: column; height: 620px; }
.celular-h { background: var(--celular-h, #0a8f63); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.celular-h b { display: block; }
.celular-h span { font-size: 12px; opacity: .85; }
.celular .mensagens { padding: 12px; }
.celular .bolha { max-width: 85%; font-size: 13px; }
.celular-f { display: flex; gap: 6px; padding: 8px; background: var(--surface); }
.celular-f input { flex: 1; border-radius: 99px; }
.evento { align-self: center; font-size: 12px; background: var(--warning-soft); color: var(--warning); padding: 4px 10px; border-radius: 8px; margin: 6px 0; text-align: center; }

/* ---------------------------------------------------------------- campanhas */
.camp { padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.camp + .camp { border-top: 1px solid var(--border); }
.camp h3 { margin: 0; font-size: 15px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.camp .meta { color: var(--muted); font-size: 12px; }
.camp .acoes { display: flex; gap: 6px; grid-row: span 2; }
.progresso { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; display: flex; gap: 2px; }
.progresso i { display: block; height: 100%; }
.progresso .p-ok { background: var(--brand); }
.progresso .p-falha { background: var(--danger); }
.preview-wpp { background: var(--chat-bg); border-radius: 12px; padding: 16px; min-height: 160px; display: flex; flex-direction: column; }
.preview-wpp .bolha { align-self: flex-end; background: var(--bubble-out); }

/* ---------------------------------------------------------------- conexão */
.qr-box { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: center; }
@media (max-width: 800px) { .qr-box { grid-template-columns: 1fr; } }
.qr-img { width: 300px; height: 300px; border-radius: 14px; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; padding: 10px; }
.qr-img img { width: 100%; height: 100%; image-rendering: pixelated; }
.passos { margin: 0; padding-left: 20px; line-height: 2; color: var(--text-2); }
.passos b { color: var(--text); }
.girando { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--brand); animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.logs { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; max-height: 360px; overflow-y: auto; }
.logs div { padding: 5px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.logs time { color: var(--muted); flex: none; }
.logs .erro { color: var(--danger); }
.logs .aviso { color: var(--warning); }
.logs .ok { color: var(--brand-text); }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px; }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 900px) {
  .app { grid-template-columns: 64px 1fr; }
  .sidebar { padding: 14px 8px; }
  .logo div, .nav-item span, .side-foot, .nav-badge, .side-eu-nome span, .side-eu-acoes #eu-senha { display: none; }
  .side-eu { align-items: center; padding: 10px 0 0; }
  .side-eu-acoes .btn { padding: 6px; font-size: 0; }
  .side-eu-acoes .btn svg.i { margin: 0; }
  .logo { justify-content: center; padding: 0 0 16px; }
  .nav-item { justify-content: center; padding: 11px; }
  .conteudo { padding: 16px; }
  .topbar { padding: 0 16px; }
  .chat-app, .chat-app.sem-detalhes { grid-template-columns: 1fr; }
  .chat-app.com-chat .chat-lista { display: none; }
  .chat-app:not(.com-chat) .chat-thread { display: none; }
  .barra-salvar { margin: 16px -16px -16px; }
}
@media (min-width: 901px) { .so-mobile { display: none !important; } }
@media (max-width: 600px) { .topbar .esconde-mobile { display: none; } }
.vazio .btn svg.i { width: 18px; height: 18px; margin: 0; stroke-width: 2; }

/* ---------------------------------------------------------------- tema dourado (Backdoor Select) */
:root[data-marca="dourado"] {
  --brand: #a8823f; --brand-hover: #8f6d31; --brand-soft: #f5ecdc; --brand-text: #7a5c22; --on-brand: #ffffff;
  --side-bg: #0d0d0d; --side-active: #1e1a12; --side-text: #cfc8bb; --side-muted: #8a8172; --side-accent: #d4b072;
  --logo-bg: #121212; --bubble-bot: #f4ede1; --celular-h: #151515;
}
@media (prefers-color-scheme: dark) {
  :root[data-marca="dourado"]:not([data-theme="light"]) {
    --brand: #cfac6c; --brand-hover: #dfc08a; --brand-soft: #2b2415; --brand-text: #e0c48f; --on-brand: #121212;
    --side-bg: #050505; --side-active: #1b1710; --bubble-bot: #2a2416; --bg: #0b0b0c; --surface: #141416; --surface-2: #19191c; --surface-3: #202024; --border: #2a2a2f; --border-strong: #36363c;
  }
}
:root[data-marca="dourado"][data-theme="dark"] {
  --brand: #cfac6c; --brand-hover: #dfc08a; --brand-soft: #2b2415; --brand-text: #e0c48f; --on-brand: #121212;
  --side-bg: #050505; --side-active: #1b1710; --bubble-bot: #2a2416; --bg: #0b0b0c; --surface: #141416; --surface-2: #19191c; --surface-3: #202024; --border: #2a2a2f; --border-strong: #36363c;
}
.logo-mark.com-logo { background: #121212; overflow: hidden; padding: 0; }
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }
.trunca { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- funil (kanban) */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(168px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.coluna { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); min-height: 200px; transition: border-color .12s, background .12s; }
.coluna.alvo { border-color: var(--brand); background: var(--brand-soft); }
.coluna header { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.cartoes { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.cartao { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-decoration: none; color: inherit; box-shadow: var(--shadow); cursor: grab; }
.cartao:hover { border-color: var(--border-strong); }
.cartao.arrastando { opacity: .4; }
.lead-box { margin: 10px 18px 0; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); border: 1px solid var(--brand); font-size: 13px; white-space: pre-wrap; line-height: 1.45; }
.barras-h div { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.barras-h i { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--brand); }

/* números do funil (de cada 10 que chegam, quantos compram) */
.fm-passos { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.fm-passos > i { align-self: center; color: var(--muted); font-style: normal; font-size: 22px; }
.fm-passo { flex: 1 1 130px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.fm-passo span { font-size: 12px; color: var(--text-2); }
.fm-passo b { font-size: 24px; line-height: 1.1; }
.fm-passo small { font-size: 11px; color: var(--muted); }
.fm-passo:last-child { border-color: var(--brand); background: var(--brand-soft); }
.fm-passo:last-child b { color: var(--brand-text); }
.fm-frase { margin: 12px 0 6px; font-size: 15px; }
.fm-tipos { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); }
.fm-meta { margin-top: 12px; }
.fm-barra { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.fm-barra span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.fm-aviso { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--warning-soft); color: var(--warning); }

/* orçamento e venda */
.ov-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--surface-2); }
.ov-item .ov-nome { flex: 1; min-width: 0; font-weight: 600; }
.ov-item .input { flex: 1; min-width: 0; }
.ov-modos { display: flex; gap: 6px; margin: 6px 0 14px; flex-wrap: wrap; }
.ov-modo { flex: 1 1 140px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 10px; padding: 10px; font-weight: 600; cursor: pointer; }
.ov-modo.ativo { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.ov-resumo { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); margin-bottom: 14px; font-size: 14px; }
.ov-previa { white-space: pre-wrap; font-family: inherit; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0 0 8px; }
.ov-botoes { flex-wrap: wrap; }

/* retomar clientes */
.rt-num { min-width: 92px; text-align: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.rt-num b { font-size: 22px; }
.rt-num span { font-size: 11px; color: var(--muted); }
.rt-progresso { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--info-soft); }
.rt-item { padding: 14px; margin-bottom: 12px; }
.rt-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rt-topo a { color: inherit; text-decoration: none; }
.rt-motivo { color: var(--text-2); margin-top: 2px; }
.rt-texto { width: 100%; resize: vertical; min-height: 64px; font-size: 14px; line-height: 1.45; }
.rt-acoes { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
@media (max-width: 640px) { .rt-acoes .btn { flex: 1 1 auto; } .fm-passos > i { display: none; } }

/* galeria de fotos do produto */
.galeria { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.g-item { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); cursor: pointer; }
.g-item.capa { border-color: var(--brand); }
.g-item img { width: 100%; height: 100%; object-fit: cover; }
.g-item span { position: absolute; left: 0; right: 0; bottom: 0; background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 700; text-align: center; }
.g-item button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 1; }

.audio-msg { display: flex; align-items: center; gap: 6px; min-width: 240px; }
.audio-msg audio { height: 36px; flex: 1; }

/* mídias das conversas */
.midia { margin-bottom: 4px; white-space: normal; }
.midia img, .midia video { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; cursor: zoom-in; }
.midia video { cursor: default; }
.midia-espera { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-height: 30px; }
.midia-erro { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 13px; max-width: 320px; }
.midia-erro small { color: var(--muted); line-height: 1.3; }
.girando.peq { width: 16px; height: 16px; border-width: 2px; display: inline-block; }

/* ações grandes da página Vendas */
.acao-grande { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 18px; cursor: pointer; border: 1px solid var(--border); font: inherit; color: inherit; }
.acao-grande:hover { border-color: var(--brand); background: var(--brand-soft); }
.acao-grande b { display: block; font-size: 16px; margin-bottom: 4px; }
.acao-grande small { color: var(--text-2); line-height: 1.4; }
.ag-icone { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; flex: none; }
.ag-icone svg.i { width: 22px; height: 22px; }

/* agente de IA */
.ia-intro{background:var(--brand-soft,rgba(201,162,39,.1));border:1px solid var(--border);border-radius:12px;padding:12px 14px;margin-bottom:16px}
.ia-uso{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-top:16px}
.ia-dias{display:flex;gap:6px;align-items:flex-end;margin:12px 0 14px;padding:10px 12px;border:1px solid var(--border);border-radius:10px}
.ia-dias>div{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;min-width:0}
.ia-dias span{width:100%;max-width:34px;background:var(--brand);border-radius:4px 4px 0 0}
.ia-dias b{font-size:11px;font-weight:600;white-space:nowrap}
.ia-dias small{font-size:11px;color:var(--muted)}
.ia-uso>div{border:1px solid var(--border);border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;gap:4px}
.ia-uso b{font-size:18px}
@media (max-width:700px){.ia-uso{grid-template-columns:1fr}}
.sim-modo{margin-left:auto;display:flex;background:rgba(255,255,255,.15);border-radius:999px;padding:2px}
.sim-modo button{border:0;background:transparent;color:#fff;font:inherit;font-size:12px;padding:4px 10px;border-radius:999px;cursor:pointer}
.sim-modo button.ativo{background:#fff;color:#111;font-weight:600}
.sim-modo + #sim-reset{margin-left:6px!important}
