/* ============================================================================
   LandSystem CRM — mesma paleta e linguagem visual do LandSystem Hub.
   Tema escuro por padrão (color-scheme dark), com tema claro opcional.
   ============================================================================ */

:root {
    color-scheme: dark;

    /* Paleta base (idêntica ao Hub) */
    --bg-page: #0d1418;
    --bg-app: #111b21;
    --bg-header: #202c33;
    --bg-card: #1f2c34;
    --bg-input: #2a3942;
    --bg-hover: #33454f;
    --text: #e9edef;
    --text-muted: #8696a0;
    --primary: #00a884;
    --primary-contrast: #081b16;
    --danger: #ea868f;
    --info: #53bdeb;
    --warning: #e0a800;
    --roxo: #8b7fd1;
    --border: #2a3942;

    /* Tokens de CRM */
    --ganho: #00a884;
    --perdido: #ea868f;
    --quente: #f0a830;
    --frio: #53bdeb;
    --sombra: 0 6px 20px rgba(0, 0, 0, 0.35);
    --sombra-sutil: 0 1px 2px rgba(0, 0, 0, 0.3);
    --raio: 12px;
    --raio-sm: 8px;
    --sidebar-w: 236px;
}

:root[data-tema="claro"] {
    color-scheme: light;
    --bg-page: #eef2f4;
    --bg-app: #f6f8fa;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #eef2f4;
    --bg-hover: #e4ebef;
    --text: #0f1b22;
    --text-muted: #5a6b74;
    --primary: #008f72;
    --primary-contrast: #ffffff;
    --border: #d8e0e4;
    --sombra: 0 6px 20px rgba(15, 40, 55, 0.12);
    --sombra-sutil: 0 1px 2px rgba(15, 40, 55, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
    background-color: var(--bg-page);
    color: var(--text);
    overflow: hidden;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

button { cursor: pointer; font: inherit; color: inherit; }
a { color: var(--info); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Tela de acesso (login / instalação) ---------- */

body.pagina-acesso { display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.cartao-acesso {
    width: 100%; max-width: 420px; background: var(--bg-app);
    border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px;
    box-shadow: var(--sombra);
}
.marca-acesso { text-align: center; margin-bottom: 22px; }
.marca-acesso .logo-crm { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; }
.marca-acesso .logo-crm b { color: var(--primary); }
.marca-acesso p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.painel-acesso { display: flex; flex-direction: column; gap: 14px; }
.painel-acesso h2 { font-size: 1.1rem; }
.texto-acesso { color: var(--text-muted); font-size: 0.86rem; text-align: center; }
.alerta-acesso { background: rgba(234, 134, 143, 0.12); color: var(--danger); border: 1px solid rgba(234,134,143,0.3); padding: 10px 12px; border-radius: var(--raio-sm); font-size: 0.88rem; }
.alerta-acesso.ok { background: rgba(0,168,132,0.12); color: var(--primary); border-color: rgba(0,168,132,0.3); }
.link-texto { background: none; border: none; color: var(--info); text-decoration: underline; }

/* ---------- Campos de formulário ---------- */

.form-campo { display: flex; flex-direction: column; gap: 6px; }
.form-campo > span { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.form-linha { display: flex; gap: 12px; flex-wrap: wrap; }
.form-linha > .form-campo { flex: 1 1 140px; }
input, select, textarea {
    background: var(--bg-input); color: var(--text); border: 1px solid transparent;
    border-radius: var(--raio-sm); padding: 11px 12px; font-size: 0.95rem; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 72px; }
@media (max-width: 899px) and (pointer: coarse) { input, select, textarea { font-size: 16px; } }
.mostrar-senha { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); }
.mostrar-senha input { width: auto; }

/* ---------- Botões ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border);
    background: var(--bg-input); border-radius: var(--raio-sm); padding: 10px 16px; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ganho { background: var(--ganho); color: var(--primary-contrast); border-color: var(--ganho); }
.btn-perdido { background: transparent; color: var(--danger); border-color: rgba(234,134,143,0.4); }
.btn-perdido:hover { background: rgba(234,134,143,0.1); }
.btn-bloco { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-icone { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: 0 0 auto; border-radius: 50%; background: transparent; border: none; color: var(--text-muted); }
.btn-icone:disabled { opacity: .35; cursor: default; }
.btn-icone:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 0.82rem; }

/* ---------- Estrutura do app (sidebar + conteúdo) ---------- */

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: auto 1fr; grid-template-areas: "marca topo" "nav principal"; height: 100vh; height: 100dvh; }

.barra-marca { grid-area: marca; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 58px;
    background: var(--bg-app); border-bottom: 2px solid var(--primary); border-right: 1px solid var(--border); }
.barra-marca .logo-crm { font-weight: 800; font-size: 1.12rem; letter-spacing: -0.3px; }
.barra-marca .logo-crm b { color: var(--primary); }
.barra-marca .logo-crm small { display: block; font-size: 0.62rem; font-weight: 600; color: var(--text-muted); letter-spacing: 1.5px; }

.lateral { grid-area: nav; background: var(--bg-app); border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--raio-sm); color: var(--text-muted); font-weight: 600; font-size: 0.92rem; border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.ativo { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-sep { flex: 1; }
.nav-rodape { font-size: 0.72rem; color: var(--text-muted); padding: 8px 12px; border-top: 1px solid var(--border); }

.topo { grid-area: topo; display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 58px; background: var(--bg-header); border-bottom: 1px solid var(--border); }
.topo h1 { font-size: 1.1rem; font-weight: 700; margin-right: auto; }
.topo .busca-topo { position: relative; }
.topo .busca-topo input { width: 220px; padding-left: 34px; }
.topo .busca-topo svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.chip-plano { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.avatar-usuario { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; cursor: pointer; user-select: none; }
.mini-avatar, .nav-item, .bottom-nav button { user-select: none; }
.seletor-funil { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--raio-sm); padding: 8px 10px; font-weight: 600; width: auto; min-width: 150px; }

.principal { grid-area: principal; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.vista { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.vista.ativa { display: flex; }
.vista-rolagem { overflow-y: auto; padding: 18px; }

/* ---------- Faixa de indicadores (dashboard + topo do funil) ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--raio); padding: 14px 16px; box-shadow: var(--sombra-sutil); }
.kpi .rotulo { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi .valor { font-size: 1.5rem; font-weight: 800; margin-top: 4px; letter-spacing: -0.5px; }
.kpi .sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.kpi.destaque .valor { color: var(--primary); }
.kpi.ganho .valor { color: var(--ganho); }
.kpi.perda .valor { color: var(--danger); }

/* ---------- Quadro Kanban ---------- */

.funil-barra { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--bg-app); flex-shrink: 0; flex-wrap: wrap; }
.quadro { flex: 1; display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; padding: 16px 18px; align-items: flex-start; }
.coluna { flex: 0 0 290px; display: flex; flex-direction: column; max-height: 100%; background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--raio); }
.coluna-cabecalho { padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.coluna-cabecalho .nome { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem; }
.coluna-cabecalho .ponto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.coluna-cabecalho .resumo { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; display: flex; justify-content: space-between; }
.coluna-lista { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 60px; flex: 1; }
.coluna-lista.arrastando-sobre { background: color-mix(in srgb, var(--primary) 10%, transparent); outline: 2px dashed var(--primary); outline-offset: -4px; border-radius: var(--raio-sm); }

.cartao-negocio { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--raio-sm); padding: 12px; box-shadow: var(--sombra-sutil); cursor: grab; border-left: 3px solid var(--primary); }
.cartao-negocio:hover { border-color: var(--primary); }
.cartao-negocio.arrastando { opacity: 0.5; }
.cartao-negocio .titulo { font-weight: 700; font-size: 0.92rem; margin-bottom: 6px; line-height: 1.3; }
.cartao-negocio .valor { color: var(--primary); font-weight: 800; font-size: 0.95rem; }
.cartao-negocio .meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.cartao-negocio .cliente { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; background: var(--bg-input); }
.tag.alerta { background: rgba(224,168,0,0.15); color: var(--warning); }
.tag.atraso { background: rgba(234,134,143,0.15); color: var(--danger); }
.tag.andamento { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.tag.ok { background: color-mix(in srgb, var(--ganho) 18%, transparent); color: var(--ganho); }
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--roxo); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700; }

/* ---------- Listas (contatos / atividades) ---------- */

.lista-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cartao-lista { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--raio); padding: 14px 16px; box-shadow: var(--sombra-sutil); }
.cartao-lista h3 { font-size: 1rem; }
.cartao-lista .sub { color: var(--text-muted); font-size: 0.84rem; margin-top: 2px; }
.cartao-lista .linha-info { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 0.82rem; color: var(--text-muted); flex-wrap: wrap; }

.grupo-agenda { margin-bottom: 20px; }
.grupo-agenda h2 { font-size: 0.86rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.grupo-agenda.atrasadas h2 { color: var(--danger); }
.item-atividade { display: flex; align-items: flex-start; gap: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--raio-sm); padding: 12px 14px; margin-bottom: 8px; }
.item-atividade .check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--text-muted); flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; }
.item-atividade .check:hover { border-color: var(--primary); }
.item-atividade.concluida .check { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.item-atividade.concluida .corpo .titulo { text-decoration: line-through; color: var(--text-muted); }
.item-atividade.cancelada .corpo .titulo { text-decoration: line-through; color: var(--text-muted); }
.item-atividade.cancelada { opacity: .75; }
.item-atividade .sel-status { font-size: .78rem; padding: 4px 6px; max-width: 150px; align-self: center; }
.item-atividade .corpo { flex: 1; min-width: 0; }
.item-atividade .corpo .titulo { font-weight: 600; font-size: 0.92rem; }
.item-atividade .corpo .sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.icone-tipo { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.9rem; }

/* ---------- Dashboard: funil horizontal e ranking ---------- */

.painel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.cartao-painel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--raio); padding: 16px 18px; box-shadow: var(--sombra-sutil); }
.cartao-painel h2 { font-size: 0.95rem; margin-bottom: 14px; }
.barra-etapa { margin-bottom: 12px; }
.barra-etapa .topo-barra { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 4px; }
.barra-etapa .trilho { height: 10px; background: var(--bg-input); border-radius: 6px; overflow: hidden; }
.barra-etapa .preenche { height: 100%; border-radius: 6px; }
.linha-ranking { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.linha-ranking:last-child { border-bottom: none; }
.linha-ranking .nome { flex: 1; font-weight: 600; font-size: 0.9rem; }
.linha-ranking .num { font-weight: 800; color: var(--primary); }
.meta-mini { height: 6px; background: var(--bg-input); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.meta-mini span { display: block; height: 100%; background: var(--primary); }

/* ---------- Drawer de detalhe do negócio ---------- */

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.overlay.aberto { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 480px; max-width: 94vw; background: var(--bg-app); border-left: 1px solid var(--border); z-index: 50; transform: translateX(100%); transition: transform 0.25s ease; display: flex; flex-direction: column; box-shadow: var(--sombra); }
.drawer.aberto { transform: translateX(0); }
.drawer-cabecalho { padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--bg-header); }
.drawer-cabecalho .titulo { font-size: 1.15rem; font-weight: 800; }
.drawer-cabecalho .valor-grande { font-size: 1.4rem; color: var(--primary); font-weight: 800; margin-top: 4px; }
.drawer-acoes { display: flex; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.drawer-corpo { flex: 1; overflow-y: auto; padding: 18px; }

/* Abas do detalhe do negócio (seções: Dados, Atividades, Reuniões, Propostas e pedidos, Documentos) */
.drawer-cabecalho .codigo-negocio { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.78rem; color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 2px; }
.abas-wrap { position: relative; background: var(--bg-header); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.abas-drawer { display: flex; gap: 2px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.abas-drawer::-webkit-scrollbar { height: 0; }
/* Setinhas discretas (só no computador, e só quando há conteúdo para rolar) */
.abas-seta { position: absolute; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--sombra-sutil); color: var(--text); display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 3; font-size: 0.82rem; line-height: 1; padding: 0; }
.abas-seta.esq { left: 3px; }
.abas-seta.dir { right: 3px; }
.abas-seta:hover { color: var(--primary); border-color: var(--primary); }
@media (hover: hover) and (pointer: fine) {
    .abas-wrap.mostra-esq .abas-seta.esq { display: inline-flex; }
    .abas-wrap.mostra-dir .abas-seta.dir { display: inline-flex; }
}
.aba-btn { flex: 0 0 auto; background: none; border: none; color: var(--text-muted); font-weight: 600; font-size: 0.84rem; padding: 11px 10px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.aba-btn:hover { color: var(--text); }
.aba-btn.ativa { color: var(--primary); border-bottom-color: var(--primary); }
.aba-btn .pino { background: var(--border); color: var(--text); font-size: 0.7rem; font-weight: 800; border-radius: 10px; padding: 0 6px; min-width: 16px; text-align: center; line-height: 16px; }
.aba-btn.ativa .pino { background: var(--primary); color: #fff; }
.aba-painel { display: none; padding: 18px; }
.aba-painel.ativa { display: block; }
.cartao-negocio .codigo { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.72rem; color: var(--text-muted); font-weight: 700; margin-bottom: 2px; }

/* Lista de funis (Configurações → Funis e etapas) */
.lista-funis { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--raio-sm); overflow: hidden; }
.linha-funil { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.linha-funil:last-child { border-bottom: none; }
.linha-funil:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.linha-funil-nome { font-weight: 700; font-size: 0.95rem; }
.linha-funil-seta { color: var(--text-muted); font-size: 1.3rem; line-height: 1; }

.secao { margin-bottom: 22px; }
.secao h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; }
.dado-linha { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; clear: both; }
.dado-linha > span:first-child { min-width: 0; }
.dado-linha > span:last-child { flex: 0 0 auto; margin-left: auto; }

/* Tabela de dados estilo planilha (cabeçalho congelado + filtro por coluna) */
.tabela-wrap { display: flex; flex-direction: column; gap: 6px; }
.tabela-rolagem { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--border); border-radius: var(--raio-sm); background: var(--bg-app); }
.tabela-dados { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.84rem; white-space: nowrap; }
.tabela-dados thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-header); text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 2px solid var(--border); }
.tabela-dados thead th:not(:last-child) { border-right: 1px solid var(--border); }
.tabela-dados .th-topo { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; user-select: none; }
.tabela-dados .th-topo:hover { color: var(--primary); }
.tabela-dados .ord { color: var(--primary); font-size: 0.7rem; }
.tabela-dados .th-filtro { display: flex; gap: 2px; align-items: center; }
.tabela-dados .filtro-col { flex: 1 1 auto; min-width: 60px; padding: 3px 6px; font-size: 0.76rem; }
.tabela-dados .filtro-menu-btn { flex: 0 0 auto; padding: 2px 5px; font-size: 0.7rem; line-height: 1; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); cursor: pointer; }
.tabela-dados .filtro-menu-btn:hover { color: var(--text); }
.tabela-dados .filtro-menu-btn.ativo { color: var(--primary); border-color: var(--primary); }
.filtro-pop { position: fixed; z-index: 100; background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--raio-sm); box-shadow: var(--sombra); padding: 6px; min-width: 190px; max-width: 260px; }
.filtro-pop .fp-lista { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; }
.filtro-pop .fp-item { display: flex; align-items: center; gap: 6px; padding: 3px 4px; font-size: 0.8rem; font-weight: 400; white-space: nowrap; cursor: pointer; }
.filtro-pop .fp-item:hover { background: var(--bg-hover); }
.filtro-pop .fp-all { border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 5px; }
.filtro-pop input[type=checkbox] { width: auto; margin: 0; }
.tabela-dados tbody td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.tabela-dados tbody tr:hover td { background: var(--bg-hover); }
.tabela-rodape { font-size: 0.78rem; color: var(--text-muted); padding-left: 2px; }
.tabela-dados .col-sel { width: 34px; text-align: center; }
.tabela-dados .col-sel input[type=checkbox] { width: auto; margin: 0; cursor: pointer; }
.lote-barra { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: color-mix(in srgb, var(--primary) 10%, var(--bg-app)); border: 1px solid var(--primary); border-radius: var(--raio-sm); font-size: 0.84rem; flex-wrap: wrap; }
.lote-conta { font-weight: 700; }
.dado-linha .rot { color: var(--text-muted); }
.selo-status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.selo-status.aberto { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.selo-status.ganho { background: color-mix(in srgb, var(--ganho) 18%, transparent); color: var(--ganho); }
.selo-status.perdido { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.selo-status.ativo { background: color-mix(in srgb, var(--ganho) 18%, transparent); color: var(--ganho); }
.selo-status.inativo { background: var(--bg-hover); color: var(--text-muted); }

.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-item .ponto { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-input); display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; font-size: 0.7rem; }
.timeline-item.sistema .ponto { background: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--primary); }
.timeline-item .conteudo { flex: 1; }
.timeline-item .conteudo .texto { font-size: 0.9rem; }
.timeline-item .conteudo .quando { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.caixa-nota { display: flex; gap: 8px; margin-bottom: 16px; }

/* ---------- Modal de formulário ---------- */

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.aberto { display: flex; }
.modal { background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--raio); width: 100%; max-width: 480px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--sombra); }
/* O form precisa ser flex-column com min-height:0 para o corpo rolar e o rodapé ficar fixo;
   sem isso, campos longos (ex.: Observações) transbordavam para fora da caixa e cliques
   caíam no overlay, fechando o modal. */
#modalForm { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.modal-cabecalho { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; }
.modal-cabecalho h2 { font-size: 1.05rem; }
.modal-corpo { padding: 18px; flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-rodape { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex: 0 0 auto; }
/* Tela cheia de exibição/edição (contatos, organizações): ocupa a área do quadro */
.painel-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.painel-titulo { font-size: 1.25rem; font-weight: 800; }
.form-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grade .campo-full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grade { grid-template-columns: 1fr; } }

/* ---------- Vazio / toasts ---------- */

.vazio { text-align: center; color: var(--text-muted); padding: 50px 20px; }
.vazio svg { width: 54px; height: 54px; opacity: 0.4; margin-bottom: 12px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--bg-header); color: var(--text); border: 1px solid var(--border); border-radius: var(--raio-sm); padding: 12px 18px; box-shadow: var(--sombra); font-size: 0.9rem; animation: surge 0.2s; }
.toast.erro { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--primary); }
@keyframes surge { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.offline-faixa { background: var(--warning); color: #1a1200; text-align: center; padding: 6px; font-size: 0.82rem; font-weight: 600; }

/* ---------- Mobile ---------- */

.bottom-nav { display: none; }
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "marca" "topo" "principal"; }
    .lateral { display: none; }
    .topo { padding: 0 12px; }
    .topo h1 { font-size: 1rem; }
    .topo .busca-topo { display: none; }
    .principal { padding-bottom: 62px; }
    .coluna { flex-basis: 85vw; }
    .painel-grid { grid-template-columns: 1fr; }
    .drawer { width: 100%; }
    .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: var(--bg-header); border-top: 1px solid var(--border); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
    .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: none; color: var(--text-muted); font-size: 0.68rem; font-weight: 600; }
    .bottom-nav button.ativo { color: var(--primary); }
    .bottom-nav button svg { width: 22px; height: 22px; }
}

/* Botão flutuante (novo negócio) */
.fab { position: fixed; right: 22px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); border: none; box-shadow: var(--sombra); display: flex; align-items: center; justify-content: center; z-index: 25; }
.fab svg { width: 26px; height: 26px; }
@media (max-width: 860px) { .fab { bottom: 72px; } }

/* Landsystem: identidade compartilhada com o e-commerce. */
:root {--bg-page:#060606;--bg-app:#0b0b0b;--bg-header:#080808;--bg-card:#111111;--bg-input:#191919;--bg-hover:#202020;--text:#f5f5f5;--text-muted:#95959f;--primary:#49b34f;--primary-contrast:#ffffff;--border:#28282b;--ganho:#49b34f;--info:#63a9df;--sidebar-w:255px;--sombra-sutil:none;--raio:15px;}
.logo-crm {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;}
.logo-crm img {width:58px;height:58px;object-fit:contain;}
.logo-crm strong {color:var(--primary);font-size:21px;letter-spacing:1px;font-weight:750;}
.logo-crm small {color:var(--text)!important;font-size:10px!important;letter-spacing:4px!important;}
.barra-marca {height:150px;justify-content:center;padding:18px;border-bottom:1px solid var(--border);}
.topo {height:78px;padding:0 32px;}
.topo h1 {font-size:20px;}
.topo h1::after {content:'Organize seus relacionamentos e acompanhe suas vendas.';display:block;font-size:13px;color:var(--text-muted);font-weight:400;margin-top:5px;}
.lateral {padding:23px 15px 12px;gap:7px;}
.nav-item {padding:13px 16px;min-height:46px;font-size:14px;font-weight:500;border:1px solid transparent;border-radius:13px;gap:14px;}
.nav-item.ativo {background:#1a1a1a;color:#fff;border-color:#2c2c2c;}
.nav-item:hover {border-color:var(--border);}
.nav-item svg {stroke-width:1.7;}
.vista-rolagem {padding:30px 32px;}
.btn-primary {box-shadow:0 4px 16px #49b34f20;font-weight:650;}
input,select,textarea {border-color:var(--border);}
.btn-icone {border:1px solid var(--border);width:38px;height:38px;}
.kpis {gap:16px;}.kpi {padding:22px;min-height:135px;position:relative;overflow:hidden;}
.kpi .rotulo {font-size:12px;letter-spacing:.3px;text-transform:none;}
.kpi .valor {font-size:29px;margin:15px 0 6px;font-weight:700;}
.kpi:first-child {border-color:#36783a;background:linear-gradient(135deg,#142516,#101310);}
.cartao-painel {padding:24px;}.cartao-painel h2 {font-size:16px;margin-bottom:24px;}
.painel-grid {gap:20px;margin-top:24px;}.barra-etapa {margin-bottom:20px;}.barra-etapa .trilho {height:7px;margin-top:10px;}
.inline-icon {width:17px;height:17px;display:inline-block;vertical-align:-3px;flex-shrink:0;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;}
.btn .inline-icon {margin-right:5px;}.icone-tipo .inline-icon {width:19px;height:19px;}
.nav-rodape {padding:17px 10px;font-size:12px;display:flex;align-items:center;gap:11px;line-height:1.7;}
.nav-avatar {background:var(--primary);border-radius:50%;width:38px;height:38px;display:grid;place-items:center;color:white;font-weight:600;flex-shrink:0;}
.dashboard-intro {display:flex;align-items:center;justify-content:space-between;margin-bottom:28px;gap:20px;}.dashboard-intro h2 {font-size:22px;margin-bottom:7px;}.dashboard-intro p {font-size:14px;color:var(--text-muted);}.intro-label {color:var(--primary);font-size:11px;letter-spacing:1.6px;margin-bottom:10px;font-weight:650;}
.pagina-acesso {background:radial-gradient(ellipse at 50% 0,#142316 0,transparent 58%),#060606;}
.cartao-acesso {max-width:430px;padding:38px 34px;border-radius:18px;}.marca-acesso {margin-bottom:30px;}.marca-acesso .logo-crm {margin-bottom:22px;}.marca-acesso p {font-size:13px;}
@media(min-width:900px){.app-shell{grid-template-rows:78px 72px 1fr;grid-template-areas:'marca topo' 'marca principal' 'nav principal';}}
@media(max-width:899px){.barra-marca {height:64px;padding:7px;}.barra-marca .logo-crm{flex-direction:row;gap:8px;}.barra-marca .logo-crm img{width:32px;height:32px;}.barra-marca .logo-crm strong{font-size:15px;}.topo {height:auto;min-height:64px;padding:10px 16px;}.topo h1::after{display:none;}.vista-rolagem{padding:20px 16px;}.dashboard-intro{align-items:flex-start;flex-direction:column;}.kpi{min-height:125px;padding:16px;}.painel-grid{grid-template-columns:1fr;}.logo-crm small{letter-spacing:2px!important;}}
