/* ═══════════════════════════════════════════════════════════════
   LeadBase — sistema de design único (todas as telas)
   Fonte de valores: .superdesign/design-system.md (claro e utilitário,
   acento verde-escuro #0f766e; roxo só para estados da IA).
   Carregar DEPOIS do <style> de cada página: as variáveis abaixo
   sobrescrevem as antigas (--bg, --bg2, --bg-primary, --bg-card…).
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface2: #f0f2f5; --surface3: #e4e7ec;
  --border: #e4e7ec; --border2: #d0d5dd;
  --text: #101828; --text2: #475467; --muted: #98a2b3;
  --accent: #0f766e; --accent2: #0b5f59; --accent-soft: #e6f4f1;
  --ok: #15803d; --ok-soft: #dcfce7;
  --warn: #b54708; --warn-soft: #fef0c7;
  --err: #b42318; --err-soft: #fee4e2;
  --blue: #1d4ed8; --blue-soft: #dbeafe;
  --ai: #6d28d9; --ai-soft: #ede9fe;
  --wa: #25d366; --ig: #e1306c;
  --r: 10px; --r2: 8px;
  --sb: 212px;
  --shadow-light: 0 1px 2px rgba(16,24,40,.06);
  --shadow-pop: 0 12px 24px rgba(16,24,40,.12);
  /* aliases das páginas antigas */
  --bg2: var(--surface); --bg3: var(--surface2); --bg4: var(--surface3);
  --bg-primary: var(--bg); --bg-secondary: var(--surface); --bg-card: var(--surface); --bg-card-hover: var(--surface2);
  --border-color: var(--border); --border-focus: var(--accent);
  --text-main: var(--text); --text-muted: var(--text2);
  --accent-green: var(--ok); --accent-green-glow: var(--ok-soft); --accent-blue: var(--accent); --accent-blue-glow: var(--accent-soft);
  --accent-purple: var(--ai); --danger: var(--err); --roxo: var(--accent); --roxo2: var(--accent2);
  --radius: var(--r); --transition: all .15s ease;
}
html, body { background: var(--bg) !important; color: var(--text); font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', sans-serif; }
body { min-height: 100vh; margin: 0; }
* { box-sizing: border-box; }
button { font-family: inherit; cursor: pointer; } input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }
a { color: var(--blue); }
code { background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 11.5px; color: var(--text); }

/* ── casca ── */
.app { display: flex; min-height: 100vh; }
.sb { width: var(--sb); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; overflow-y: auto; }
.sb-brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 14px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--text); }
.sb-brand .logo { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; }
.sb-brand small { display: block; font-size: 10.5px; color: var(--text2); font-weight: 500; letter-spacing: .02em; }
.sb-sec { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text2); text-decoration: none; font-size: 13px; font-weight: 500; position: relative; transition: all .15s ease; }
.sb-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sb-item:hover { background: var(--surface2); color: var(--text); }
.sb-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sb-item.on::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.sb-item .badge { margin-left: auto; background: var(--surface3); color: var(--text2); font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 9px; line-height: 16px; min-width: 18px; text-align: center; }
.sb-item.on .badge { background: var(--accent); color: #fff; }
.sb-foot { margin-top: auto; padding: 10px 6px 0; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); }
.sb-foot .av { width: 26px; height: 26px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; color: var(--text); }
.sb-foot .sair { margin-left: auto; background: var(--surface); border: 1px solid var(--border2); color: var(--text2); font-size: 11px; padding: 4px 9px; border-radius: 7px; }
.sb-foot .sair:hover { color: var(--err); border-color: var(--err); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-light); position: sticky; top: 0; z-index: 20; min-height: 60px; }
.tb h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0; color: var(--text); }
.tb .sub { color: var(--text2); font-size: 12px; }
.tb .acoes { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-body { padding: 20px 24px 40px; flex: 1; }
@media (max-width: 900px) {
  .app { flex-direction: column; } .sb { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .sb-brand { width: 100%; padding-bottom: 6px; } .sb-sec { display: none; } .sb-item { padding: 7px 10px; font-size: 12px; } .sb-foot { display: none; }
  .tb { padding: 10px 14px; } .app-body { padding: 14px; }
}

/* ── componentes ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r2); border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; transition: all .15s ease; box-shadow: var(--shadow-light); }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: var(--surface2); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } .btn.pri:hover { background: var(--accent2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); box-shadow: none; } .btn.ghost:hover { background: var(--surface2); color: var(--text); }
.btn.danger { color: var(--err); } .btn.danger:hover { background: var(--err-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; } .btn:disabled { opacity: .5; cursor: default; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-light); }
.card + .card { margin-top: 14px; }
.card > h3, .card-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 0 0 12px; color: var(--text); }
.card-h .r { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--text2); display: flex; gap: 8px; align-items: center; }
.sub { font-size: 12px; color: var(--text2); line-height: 1.55; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; box-shadow: var(--shadow-light); }
.kpi b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; color: var(--text); } .kpi span { font-size: 11.5px; color: var(--text2); display: block; margin-top: 3px; }
.kpi svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; flex-shrink: 0; margin-top: 2px; }
.kpi.txt b { font-size: 15px; margin-top: 3px; }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r2); padding: 3px; gap: 2px; }
.seg button { background: none; border: none; color: var(--text2); padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; transition: all .15s ease; } .seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-light); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--text2); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.st.ok, .st.publicado, .st.enviado, .st.conectado { background: var(--ok-soft); color: var(--ok); }
.st.warn, .st.agendado, .st.aguardando, .st.publicando, .st.parcial, .st.pendente { background: var(--warn-soft); color: var(--warn); }
.st.err, .st.erro, .st.perdida { background: var(--err-soft); color: var(--err); }
.st.info, .st.nova, .st.atendimento { background: var(--blue-soft); color: var(--blue); }
.st.ia { background: var(--ai-soft); color: var(--ai); }
.st.mute, .st.rascunho, .st.cancelado, .st.concluida { background: var(--surface3); color: var(--text2); }
.f { margin-bottom: 12px; } .f label { display: block; font-size: 11px; color: var(--text2); margin-bottom: 5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.f input, .f textarea, .f select, .inp { width: 100%; padding: 8px 11px; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r2); color: var(--text); font-size: 13px; outline: none; transition: all .15s ease; }
.f input:focus, .f textarea:focus, .f select:focus, .inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.f textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.tbl { width: 100%; border-collapse: collapse; } .tbl th { text-align: left; font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; } .tbl tr:last-child td { border-bottom: none; } .tbl tr:hover td { background: var(--surface2); }
.vazio { padding: 26px; text-align: center; color: var(--text2); font-size: 13px; border: 1px dashed var(--border2); border-radius: var(--r); background: var(--surface); }
.msg { font-size: 12px; margin-top: 8px; min-height: 1.2em; color: var(--text2); } .msg.ok { color: var(--ok); } .msg.erro { color: var(--err); } .msg.warn { color: var(--warn); }
.dd { position: relative; } .dd-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 6px; min-width: 190px; z-index: 30; box-shadow: var(--shadow-pop); display: none; }
.dd.open .dd-menu { display: block; } .dd-menu label { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; } .dd-menu label:hover { background: var(--surface2); }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--text); color: #fff; padding: 12px 16px; border-radius: var(--r); font-size: 13px; display: none; z-index: 90; box-shadow: var(--shadow-pop); max-width: 380px; }
.toast.show { display: block; }
.ic { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; flex-shrink: 0; }
.ic svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 2.2; }
.ic.wa { background: var(--wa); } .ic.ig { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.painel-lat { position: sticky; top: 76px; }
.timeline { position: relative; padding-left: 16px; } .timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border2); }
.timeline .tl { position: relative; font-size: 12px; color: var(--text2); padding: 4px 0 10px; line-height: 1.4; } .timeline .tl::before { content: ''; position: absolute; left: -15px; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--surface); }
.timeline .tl.ok::before { background: var(--ok); } .timeline .tl.err::before { background: var(--err); } .timeline .tl.warn::before { background: var(--warn); } .timeline .tl b { color: var(--text); font-weight: 600; }
