:root {
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #efeee9;
  --line: #e2e0d9;
  --ink: #16150f;
  --ink-2: #52514e;
  --ink-3: #85837c;
  --accent: #1d4f91;
  --accent-ink: #ffffff;
  --accent-soft: #e3ecf8;
  --gold: #a8812f;
  --gold-soft: #f6eedb;
  --navy: #12305a;
  --series: #2a78d6;
  --series-soft: #dbe8f8;
  --bubble-lead: #ffffff;
  --bubble-bot: #dcf3e6;
  --chat-bg: #ece9e1;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #f9e1df;
  --good: #0a7a0a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 18, 10, .06), 0 2px 8px rgba(20, 18, 10, .04);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2f2f2c;
    --ink: #f5f5f2; --ink-2: #c3c2b7; --ink-3: #8e8d85;
    --accent: #7fb0f0; --accent-ink: #0b1a30; --accent-soft: #1a2c47; --gold: #d8b45c; --gold-soft: #3a3016;
    --series: #3987e5; --series-soft: #1c3150;
    --bubble-lead: #232321; --bubble-bot: #17392c; --chat-bg: #151514;
    --warn: #f0b04a; --warn-soft: #3a2c12; --bad: #f2867e; --bad-soft: #3d1c1a; --good: #4cc44c;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2f2f2c;
  --ink: #f5f5f2; --ink-2: #c3c2b7; --ink-3: #8e8d85;
  --accent: #7fb0f0; --accent-ink: #0b1a30; --accent-soft: #1a2c47; --gold: #d8b45c; --gold-soft: #3a3016;
  --series: #3987e5; --series-soft: #1c3150;
  --bubble-lead: #232321; --bubble-bot: #17392c; --chat-bg: #151514;
  --warn: #f0b04a; --warn-soft: #3a2c12; --bad: #f2867e; --bad-soft: #3d1c1a; --good: #4cc44c;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.oculto { display: none !important; }

/* ---------- Topo: tres colunas iguais para manter o titulo centrado ---------- */
.topo {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 56px 1fr 56px; align-items: center;
  height: 56px; padding: 0 8px; padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topo h1 { margin: 0; text-align: center; font-size: 16px; font-weight: 650; line-height: 1.15; overflow: hidden; }
.topo h1 small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone-btn {
  width: 44px; height: 44px; margin: 0 auto; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 12px; color: var(--ink-2);
}
.icone-btn:hover { background: var(--surface-2); }
.icone-btn svg { width: 22px; height: 22px; }

main { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }

/* ---------- Navegacao inferior: 5 colunas iguais ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
@media (min-width: 720px) {
  .nav { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 16px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); height: var(--nav-h); padding: 0; }
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 550;
}
.nav a svg { width: 22px; height: 22px; }
.nav a.ativo { color: var(--accent); }
.nav a.breve { opacity: .45; pointer-events: none; }

/* ---------- Blocos ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.secao { margin: 22px 0 10px; text-align: center; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; }
.nota { text-align: center; font-size: 12.5px; color: var(--ink-3); margin: 8px auto 0; max-width: 560px; }
.aviso { display: flex; gap: 8px; align-items: flex-start; justify-content: center; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; margin: 10px 0; }
.aviso.erro { background: var(--bad-soft); color: var(--bad); }

/* Seletor de dia: setas simetricas */
.dia-sel { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; max-width: 360px; margin: 0 auto 14px; }
.dia-sel .rotulo { text-align: center; font-weight: 650; }
.dia-sel .rotulo small { display: block; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.dia-sel button:disabled { opacity: .25; cursor: default; }

/* Hero */
.hero { padding: 20px 18px 18px; text-align: center; }
.hero .rot { font-size: 13px; color: var(--ink-2); font-weight: 550; }
.hero .num { font-size: 52px; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; margin: 6px 0 2px; }
.hero .num span { font-size: 22px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.medidor { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; margin: 12px auto 8px; max-width: 420px; }
.medidor > div { height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.hero .sub { font-size: 13px; color: var(--ink-3); }

/* KPIs: 2 colunas no celular, 3 no desktop (6 blocos fecham a grade) */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { padding: 14px 10px 12px; text-align: center; }
.kpi .rot { font-size: 12.5px; color: var(--ink-2); font-weight: 550; min-height: 2.5em; display: flex; align-items: center; justify-content: center; line-height: 1.25; }
.kpi .val { font-size: 30px; font-weight: 700; line-height: 1.1; margin: 2px 0; }
.kpi .val.vazio { color: var(--ink-3); font-weight: 600; }
.kpi .mes { font-size: 12px; color: var(--ink-3); }

/* Tabela de gastos simetrica */
.gastos { padding: 6px 0; }
.gastos .linha { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 10px 6px; }
.gastos .linha + .linha { border-top: 1px solid var(--line); }
.gastos .cab { font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 8px 6px 2px; }
.gastos .v { font-size: 18px; font-weight: 650; }
.gastos .v small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.gastos .total .v { color: var(--accent); }
.botao { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; }
.botao:hover { background: var(--surface-2); }
.botao.prim { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.centro { text-align: center; }

/* Grafico */
.grafico { padding: 14px 12px 8px; position: relative; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico .tit { text-align: center; font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.grafico .eixo { fill: var(--ink-3); font-size: 10px; }
.grafico .grade { stroke: var(--line); stroke-width: 1; }
.grafico .barra { fill: var(--series); }
.grafico .barra.zero { fill: var(--line); }
.grafico .alvo { fill: transparent; }
.grafico .alvo:hover + .barra, .grafico .barra.foco { fill: color-mix(in srgb, var(--series) 75%, var(--ink)); }
.dica { position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--surface); font-size: 12px; padding: 8px 10px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, -100%); line-height: 1.4; }
.dica b { font-weight: 650; }

/* Funil */
.funil { padding: 10px 14px; }
.funil .et { display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.funil .et .nome { color: var(--ink-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funil .et .trilho { height: 14px; border-radius: 0 4px 4px 0; background: transparent; }
.funil .et .trilho > div { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series); }
.funil .et .n { font-weight: 650; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); font-weight: 550; }
.chip b { color: var(--ink); }
button.chip.ativo { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Lista de conversas ---------- */
.busca { position: relative; max-width: 560px; margin: 0 auto 10px; }
.busca input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px 0 40px; outline: none; }
.busca input:focus { border-color: var(--accent); }
.busca svg { position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; color: var(--ink-3); }
.lista { max-width: 720px; margin: 12px auto 0; overflow: hidden; }
.item { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; text-decoration: none; color: inherit; }
.item + .item { border-top: 1px solid var(--line); }
.item:hover { background: var(--surface-2); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 16px; background: var(--accent-soft); color: var(--accent); }
.item .meio { min-width: 0; }
.item .nome { font-weight: 650; display: flex; gap: 6px; align-items: center; min-width: 0; }
.item .nome span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .prev { color: var(--ink-3); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .lado { text-align: right; font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.vazio-msg { text-align: center; padding: 40px 16px; color: var(--ink-3); }

/* ---------- Conversa ---------- */
body.chat main { max-width: 820px; padding: 0 0 calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
.perfil { margin: 12px 12px 0; padding: 4px 14px; }
.perfil summary { list-style: none; cursor: pointer; text-align: center; padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.perfil summary::-webkit-details-marker { display: none; }
.perfil dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0 0 10px; font-size: 13px; }
.perfil dt { color: var(--ink-3); text-align: right; }
.perfil dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.chat-area { background: var(--chat-bg); min-height: 60vh; padding: 10px 10px 20px; margin-top: 12px; }
@media (min-width: 720px) { .chat-area { border-radius: var(--radius); margin: 12px 12px 0; } }
.sep-dia { text-align: center; margin: 14px 0 8px; }
.sep-dia span { display: inline-block; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 99px; box-shadow: var(--shadow); }
.msg { display: flex; margin: 3px 0; }
.msg.bot { justify-content: flex-end; }
.balao { max-width: min(82%, 560px); padding: 7px 10px 5px; border-radius: 12px; background: var(--bubble-lead); box-shadow: 0 1px 1px rgba(0,0,0,.06); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.msg.lead .balao { border-top-left-radius: 4px; }
.msg.bot .balao { background: var(--bubble-bot); border-top-right-radius: 4px; }
.balao .rodape { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.balao .tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; color: var(--ink-2); margin-bottom: 3px; }
.balao .tag + .tag { margin-left: 6px; }
.balao.midia { font-style: italic; color: var(--ink-2); }
.balao.muted { opacity: .6; }
.balao.falhou { outline: 1.5px solid var(--bad); }
.msg.sis { justify-content: center; }
.msg.sis .balao { background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); max-width: 90%; text-align: center; }
.carregando { text-align: center; padding: 30px; color: var(--ink-3); }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 360px; padding: 28px 22px 22px; text-align: center; }
.login .logo { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.login .logo svg { width: 30px; height: 30px; }
.login h1 { font-size: 19px; margin: 0 0 4px; }
.login p { margin: 0 0 18px; color: var(--ink-3); font-size: 13.5px; }
.login input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; text-align: center; outline: none; font-size: 16px; }
.login input:focus { border-color: var(--accent); }
.login .botao { width: 100%; height: 48px; margin-top: 12px; font-size: 15px; }
.login .erro { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ---------- Lista: item selecionado e chips dentro do funil ---------- */
.item.sel { background: var(--accent-soft); }
.funil .laterais { margin: 10px 0 4px; }

/* ================= DESKTOP: tudo em uma tela, sem rolar ================= */
@media (min-width: 1100px) {
  /* Menu sobe para o centro do topo */
  .topo h1 { visibility: hidden; }
  .nav {
    top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
    width: auto; height: 56px; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent;
    grid-template-columns: repeat(5, 140px);
  }
  .nav a { flex-direction: row; gap: 8px; font-size: 14px; position: relative; }
  .nav a svg { width: 19px; height: 19px; }
  .nav a.ativo::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
  main { max-width: 1680px; padding: 16px 24px; }
  body.chat main { max-width: 1680px; padding: 16px 24px; }

  /* Tela Hoje em grade de 12 colunas */
  .painel-hoje {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto 1fr auto; gap: 12px 16px;
    min-height: calc(100dvh - 56px - 32px);
  }
  .area { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  .area > .card { flex: 1; }
  .a-graf > .card { min-height: 0; }
  .area .secao { margin: 0 0 8px; }
  .a-dia   { grid-column: 1 / 5;  grid-row: 1; }
  .a-hero  { grid-column: 1 / 5;  grid-row: 2; }
  .a-kpis  { grid-column: 5 / 13; grid-row: 1 / 3; }
  .a-gasto { grid-column: 1 / 5;  grid-row: 3; }
  .a-graf  { grid-column: 5 / 10; grid-row: 3; }
  .a-funil { grid-column: 10 / 13; grid-row: 3; }
  .a-notas { grid-column: 1 / 13; grid-row: 4; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
  .a-notas .nota { margin: 0; max-width: none; }
  .a-notas .aviso { margin: 0; }

  .dia-sel { margin: 0 auto; }
  .hero { padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; }
  .hero .num { font-size: 44px; }
  .hero .medidor { margin: 8px auto 6px; width: 100%; }
  .hero .nota { margin-top: 4px; }

  .a-kpis .kpis { flex: 1; grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
  .kpi { display: flex; flex-direction: column; justify-content: center; }
  .kpi .val { font-size: 34px; }

  .gastos { display: grid; grid-template-rows: auto 1fr 1fr auto 1fr; padding: 0; }
  .gastos .linha { align-items: center; }

  .grafico { display: flex; flex-direction: column; }
  .grafico svg { flex: 1; min-height: 0; height: 100%; }

  .funil { display: flex; flex-direction: column; justify-content: space-evenly; padding: 8px 14px; }
  .funil .et { grid-template-columns: 96px 1fr 26px; padding: 0; }

  /* Conversas: lista e conversa lado a lado */
  .split { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 16px; height: calc(100dvh - 56px - 32px); min-height: 520px; }
  .pane-lista { display: flex; flex-direction: column; min-height: 0; }
  .pane-lista .busca { margin: 0 0 10px; max-width: none; }
  .lista-rolagem { flex: 1; min-height: 0; overflow-y: auto; margin-top: 10px; border-radius: var(--radius); }
  .lista-rolagem .lista { margin: 0; max-width: none; }
  .pane-chat { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .pane-vazio { margin: auto; }
  .chat-cab { text-align: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .chat-cab .n { font-weight: 650; font-size: 16px; }
  .chat-cab .s { font-size: 12.5px; color: var(--ink-3); }
  .pane-chat .perfil { margin: 10px 16px 0; box-shadow: none; }
  .chat-rolagem { flex: 1; min-height: 0; overflow-y: auto; margin-top: 10px; }
  .chat-rolagem .chat-area { margin: 0; border-radius: 0; min-height: 100%; padding: 10px 24px 20px; }

  /* Telas baixas (notebook): compacta para caber sem rolar */
  @media (max-height: 760px) {
    main { padding-top: 10px; padding-bottom: 10px; }
    .painel-hoje { gap: 8px 14px; min-height: calc(100dvh - 56px - 20px); }
    .area .secao { margin-bottom: 4px; font-size: 11px; }
    .hero { padding: 10px 14px; }
    .hero .num { font-size: 36px; }
    .hero .nota { display: none; }
    .kpi { padding: 8px 8px; }
    .kpi .val { font-size: 28px; }
    .gastos .linha { padding: 5px 6px; }
    .gastos .v { font-size: 16px; }
    .funil .et { font-size: 12px; }
    .funil .laterais { margin: 4px 0 0; }
    .funil .laterais .chip { height: 26px; font-size: 12px; }
    .grafico { padding: 8px 10px 4px; }
    .a-notas .nota { font-size: 11.5px; }
  }
}


/* ---------- Clicaveis ---------- */
.clicavel { cursor: pointer; transition: transform .08s, box-shadow .15s, border-color .15s; }
.card.clicavel:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card.clicavel:active { transform: scale(.985); }
.clicavel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi.clicavel .mes::after { content: " ›"; color: var(--accent); font-weight: 700; }

/* ---------- Folha (lista do KPI / marcar mensagem) ---------- */
body.com-folha { overflow: hidden; }
.folha-fundo { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 8, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .15s; }
.folha-fundo.aberta { opacity: 1; }
.folha { width: 100%; max-height: 86dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(24px); transition: transform .18s; }
.folha-fundo.aberta .folha { transform: none; }
@media (min-width: 720px) {
  .folha-fundo { align-items: center; }
  .folha { width: 560px; border-radius: 20px; max-height: 80dvh; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
}
.folha-cab { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 10px 8px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.folha-tit { font-weight: 650; font-size: 16px; }
.folha-sub { font-size: 12.5px; color: var(--ink-3); }
.folha-corpo { overflow-y: auto; padding: 4px 16px 18px; }
.folha-corpo .secao { margin: 16px 0 8px; }
.folha-corpo .lista { margin: 0; max-width: none; }
.folha-corpo textarea { width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; resize: vertical; outline: none; }
.folha-corpo textarea:focus { border-color: var(--accent); }
.linha-lead .lado { gap: 6px; }
.botao.mini { height: 30px; padding: 0 10px; font-size: 12.5px; text-decoration: none; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.par-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.previa-msg { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--bubble-bot); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 30dvh; overflow-y: auto; }
.erro-folha { color: var(--bad); font-size: 13px; text-align: center; min-height: 18px; margin-top: 6px; }

/* ---------- Custo do lead ---------- */
.custo-lead { margin: 12px 12px 0; padding: 10px 8px; }
.custo-linha { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-weight: 650; font-size: 16px; }
.custo-linha small { display: block; font-size: 11.5px; font-weight: 550; color: var(--ink-3); }
.custo-linha .total { color: var(--accent); }
.custo-det { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.custo-det.oculto { display: none; }
.custo-nota { flex-basis: 100%; text-align: center; color: var(--ink-3); font-size: 11.5px; }
@media (min-width: 1100px) { .pane-chat .custo-lead { margin: 10px 16px 0; box-shadow: none; } }

/* ---------- Mensagem marcada ---------- */
.balao.clicavel:hover { filter: brightness(.97); }
.balao.marcada-ruim { outline: 2px solid var(--bad); }
.balao.marcada-boa { outline: 2px solid var(--good); }
.balao .tag.marca { color: var(--ink); }
.balao .coment { margin-top: 4px; font-size: 12.5px; font-style: italic; color: var(--ink-2); }
.info-lead { font-size: 12.5px; font-weight: 600; color: var(--accent); }

/* ================= CAMPANHAS ================= */
.chips.periodo { margin-bottom: 14px; }
.painel-camp .kpis .mes::after { content: none; }
.painel-camp .kpi.clicavel .mes::after { content: " ›"; }
.c-arv, .c-graf { margin-top: 4px; }
.num-link { border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 700; border-radius: 99px; min-width: 30px; height: 26px; padding: 0 9px; font-size: 13.5px; }
.num-link:hover { filter: brightness(.95); }
.n0 { color: var(--ink-3); }
button.link { border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; padding: 0; font-size: inherit; }

/* Cartoes (celular) */
.arv-cel { display: flex; flex-direction: column; gap: 10px; }
.camp { padding: 12px 12px 10px; text-align: center; }
.camp-nome { font-weight: 650; overflow-wrap: anywhere; }
.camp-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.mets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 6px; margin-top: 10px; }
.met { font-weight: 650; font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.met small { font-size: 11px; color: var(--ink-3); font-weight: 550; }
.camp .expandir { margin-top: 10px; }
.filhos { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.camp.nivel1, .camp.nivel2 { background: var(--bg); box-shadow: none; }

/* Tabela (PC) */
.tabela-arv { display: flex; flex-direction: column; overflow: hidden; }
.tabela-arv .tbody { overflow-y: auto; min-height: 0; flex: 1; }
.tr { display: grid; grid-template-columns: minmax(0, 2.6fr) repeat(7, minmax(0, 1fr)); align-items: center; gap: 6px; padding: 8px 14px; text-align: center; font-size: 13.5px; }
.tr + .tr { border-top: 1px solid var(--line); }
.tr.th { font-size: 11.5px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.tr.th > div:first-child, .nome-arv { text-align: left; }
.tr.nivel0 { font-weight: 650; }
.tr.nivel1 { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.tr.nivel2 { background: color-mix(in srgb, var(--surface-2) 75%, transparent); font-size: 13px; }
.nome-arv { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nome-arv.nivel1 { padding-left: 18px; }
.nome-arv.nivel2 { padding-left: 36px; }
.nome-txt { display: flex; flex-direction: column; min-width: 0; }
.nome-txt > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nome-txt small { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.seta { width: 22px; height: 22px; flex: none; border: 0; background: transparent; color: var(--ink-2); border-radius: 6px; font-size: 16px; line-height: 1; transition: transform .15s; }
.seta:hover { background: var(--surface-2); }
.seta.aberta { transform: rotate(90deg); }
.seta.vazia { display: inline-block; }

@media (min-width: 1100px) {
  .painel-camp {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 12px 16px;
    height: calc(100dvh - 56px - 32px); min-height: 560px;
  }
  .painel-camp .area { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  .painel-camp .area > .card { flex: 1; min-height: 0; }
  .c-per { grid-column: 1 / 13; grid-row: 1; }
  .c-per .chips.periodo { margin: 0; }
  .c-kpis { grid-column: 1 / 13; grid-row: 2; }
  .c-kpis .kpis.k6 { grid-template-columns: repeat(6, 1fr); }
  .c-arv { grid-column: 1 / 9; grid-row: 3; margin: 0; }
  .c-graf { grid-column: 9 / 13; grid-row: 3; margin: 0; }
  .c-notas { grid-column: 1 / 13; grid-row: 4; flex-direction: row !important; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
  .c-notas .nota, .c-notas .aviso { margin: 0; max-width: none; }
  .painel-camp .kpi .val { font-size: 28px; }
}

/* ================= FUNIL ================= */
.funil-marcos { padding: 10px 14px; display: flex; flex-direction: column; justify-content: space-evenly; gap: 8px; }
.passo { display: grid; grid-template-columns: 104px minmax(0, 1fr) 58px; grid-template-areas: "rot barra conv" "rot parou parou"; align-items: center; gap: 2px 10px; }
.p-rot { grid-area: rot; text-align: right; font-size: 13px; color: var(--ink-2); font-weight: 550; line-height: 1.2; }
.p-barra { grid-area: barra; position: relative; height: 26px; border-radius: 0 6px 6px 0; display: flex; align-items: center; }
.p-fill { height: 100%; background: var(--series); border-radius: 0 6px 6px 0; }
.p-fill.zero { width: 2px !important; background: var(--line); }
.p-n { margin-left: 8px; font-weight: 700; font-size: 15px; }
.p-conv { grid-area: conv; font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-align: right; white-space: nowrap; }
.p-parou { grid-area: parou; min-height: 0; }
.chip-parou { border: 0; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-weight: 650; border-radius: 99px; padding: 2px 9px; }
.tempos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tempos .kpi .val { font-size: 24px; }
.et-cab { display: grid; grid-template-columns: 112px 1fr 34px 74px; gap: 10px; font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; padding-bottom: 2px; }
.et-cab span:nth-child(3) { text-align: left; }
.et-cab span:nth-child(4) { text-align: right; }
.et-atual { display: grid; grid-template-columns: 112px 1fr 34px 74px; align-items: center; gap: 10px; padding: 4px 0; font-size: 13px; border-radius: 8px; }
.et-atual.clicavel:hover { background: var(--surface-2); }
.et-atual .nome { color: var(--ink-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.et-atual .trilho > div { height: 14px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series); }
.et-atual .n { font-weight: 650; }
.et-atual .tmed { text-align: right; color: var(--ink-3); font-size: 12px; }
.recentes { padding: 4px 0; overflow-y: auto; }
.rec { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) 54px; gap: 8px; padding: 8px 14px; font-size: 13px; text-decoration: none; color: inherit; align-items: center; }
.rec + .rec { border-top: 1px solid var(--line); }
.rec:hover { background: var(--surface-2); }
.rec-nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-mov { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.rec-qd { color: var(--ink-3); text-align: right; font-size: 12px; }
@media (min-width: 720px) { .tempos { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) {
  .painel-funil {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 12px 16px;
    height: calc(100dvh - 56px - 32px); min-height: 560px;
  }
  .painel-funil .area { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  .painel-funil .area > .card, .painel-funil .area > .tempos { flex: 1; min-height: 0; }
  .painel-funil .secao { margin: 0 0 8px; }
  .f-per { grid-column: 1 / 13; grid-row: 1; }
  .f-per .chips.periodo { margin: 0; }
  .f-marcos { grid-column: 1 / 8; grid-row: 2; }
  .f-atuais { grid-column: 8 / 13; grid-row: 2; }
  .f-tempos { grid-column: 1 / 8; grid-row: 3; }
  .f-tempos .tempos { grid-template-rows: 1fr; }
  .f-tempos .kpi { display: flex; flex-direction: column; justify-content: center; }
  .f-rec { grid-column: 8 / 13; grid-row: 3; }
  .f-notas { grid-column: 1 / 13; grid-row: 4; }
  .f-notas .nota { margin: 0 auto; max-width: none; }
  .etapas-atuais { display: flex; flex-direction: column; justify-content: space-evenly; }
}
@media (min-width: 1100px) {
  .etapas-atuais, .funil-marcos { overflow-y: auto; }
}
@media (min-width: 1100px) and (max-height: 760px) {
  .et-atual { padding: 1px 0; font-size: 12px; }
  .et-atual .trilho > div { height: 11px; }
  .et-cab { font-size: 9.5px; }
  .passo { gap: 0 10px; }
  .p-barra { height: 22px; }
  .chip-parou { padding: 1px 8px; font-size: 11px; }
  .f-tempos .kpi .val { font-size: 22px; }
}

/* ================= MARCA PIZANI IMOB ================= */
.topo-esq, .topo-dir { display: flex; align-items: center; min-width: 0; }
.topo-dir { justify-content: flex-end; }
.logo-topo, .sair-desk { display: none !important; }
.topo h1 { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tit-txt { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.tit-txt small { color: var(--gold); font-weight: 600; letter-spacing: .02em; }
.marca-topo { width: 26px; height: 32px; flex: none; background: url('/marca.png') center / contain no-repeat; }
body.chat .marca-topo { display: none; }
.topo { border-bottom: 1px solid var(--line); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--gold) 35%, transparent); }
.nav a.ativo { color: var(--accent); }
@media (min-width: 1100px) {
  .topo { grid-template-columns: 240px 1fr 240px; padding: 0 16px; }
  .logo-topo { display: block !important; height: 46px; width: auto; }
  #btn-esq { display: none; }
  .sair-desk { display: grid !important; margin: 0; }
  .topo-dir .icone-btn { margin: 0; }
  .nav a.ativo::after { background: var(--gold); }
}
.login .logo-login { display: block; width: 240px; max-width: 80%; height: auto; margin: 0 auto 16px; }

/* ================= CUSTOS ================= */
.tabela-custos { padding: 4px 0; overflow-y: auto; }
.tc-grupo, .tc-linha, .tc-total { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 7px 14px; align-items: center; }
.tc-grupo { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); }
.tc-linha { font-size: 13.5px; }
.tc-linha + .tc-linha { border-top: 1px solid var(--line); }
.tc-linha span { display: flex; flex-direction: column; }
.tc-linha span:last-child { text-align: right; font-weight: 650; align-items: flex-end; }
.tc-linha small, .tc-total small { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.tc-total { border-top: 2px solid var(--line); font-weight: 700; font-size: 15px; }
.tc-total span:last-child { color: var(--accent); text-align: right; }
.tc-nota { text-align: center; font-size: 11.5px; color: var(--ink-3); padding: 8px 14px 4px; }
.usos { padding: 16px; display: flex; flex-direction: column; gap: 18px; justify-content: flex-start; }
.uso-rot { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.uso .medidor { margin: 6px 0 4px; max-width: none; }
.uso .medidor.warn > div { background: var(--warn); }
.uso .medidor.bad > div { background: var(--bad); }
.uso-sub { font-size: 12px; color: var(--ink-3); }
.sim-ent { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.sim-campo { display: grid; grid-template-columns: minmax(0, 1fr) 110px; align-items: center; gap: 10px; }
.sim-rot { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; }
.sim-rot small { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.sim-campo input, .fx-linha input, .folha-corpo input[type=text], .folha-corpo input[type=date] {
  height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 10px; font: inherit; text-align: center; width: 100%; outline: none; min-width: 0;
}
.sim-campo input:focus, .fx-linha input:focus { border-color: var(--accent); }
.folha-corpo .sim-campo { margin-top: 10px; }
.folha-corpo input[type=text] { margin-top: 12px; text-align: left; }
.sim-saida { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.sim-hero { text-align: center; padding: 6px 0 12px; border-bottom: 1px solid var(--line); }
.sim-hero .rot { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.sim-hero .num { font-size: 40px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.sim-hero .sub { font-size: 12.5px; color: var(--ink-3); }
.sim-grade { display: grid; grid-template-columns: 1fr; }
.sim-l { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 7px 2px; font-size: 13.5px; align-items: center; }
.sim-l + .sim-l { border-top: 1px solid var(--line); }
.sim-l span { display: flex; flex-direction: column; }
.sim-l small { font-size: 11.5px; color: var(--ink-3); }
.sim-l b { text-align: right; }
.lista-precos { padding: 4px 0; overflow-y: auto; }
.preco { padding: 10px 14px; }
.preco + .preco { border-top: 1px solid var(--line); }
.preco-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.vig { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 7px 10px; margin-top: 6px; color: inherit; font-size: 12.5px; }
.vig:hover { border-color: var(--accent); }
.vig.atual { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.vig-data { display: flex; gap: 8px; align-items: center; font-weight: 650; }
.vig-val { color: var(--ink-2); }
.vig-fonte { color: var(--ink-3); font-size: 11.5px; }
.vig-fonte.warn { color: var(--warn); }
.fixos-ed { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.fx-cab, .fx-linha { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) 100px 40px; gap: 8px; align-items: center; }
.fx-cab { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.fx-linha input[type=text] { text-align: left; }
@media (max-width: 719px) {
  .fx-cab { display: none; }
  .fx-linha { grid-template-columns: minmax(0, 1fr) 90px 40px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .fx-linha input:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; height: 32px; }
}
.k-kpis, .k-fixos, .k-var, .k-usos, .s-ent, .s-sai, .p-precos, .p-fixos { margin-top: 4px; }
@media (min-width: 1100px) {
  .painel-custos {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 16px;
    height: calc(100dvh - 56px - 32px); min-height: 560px;
  }
  .painel-custos .area { display: flex; flex-direction: column; min-height: 0; min-width: 0; margin: 0; }
  .painel-custos .area > .card { flex: 1; min-height: 0; }
  .painel-custos .secao { margin: 0 0 8px; }
  .k-abas { grid-column: 1 / 13; grid-row: 1; }
  .k-abas .chips.periodo { margin: 0; }
  .aba-resumo { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .k-kpis { grid-column: 1 / 13; grid-row: 2; }
  .k-kpis .kpis.k6 { grid-template-columns: repeat(6, 1fr); }
  .k-kpis .kpi .val { font-size: 26px; }
  .k-fixos { grid-column: 1 / 5; grid-row: 3; }
  .k-var { grid-column: 5 / 9; grid-row: 3; }
  .k-usos { grid-column: 9 / 13; grid-row: 3; }
  .k-notas { grid-column: 1 / 13; grid-row: 4; }
  .k-notas .nota { margin: 0 auto; max-width: none; }
  .aba-sim { grid-template-rows: auto minmax(0, 1fr); }
  .s-ent { grid-column: 1 / 7; grid-row: 2; }
  .s-sai { grid-column: 7 / 13; grid-row: 2; }
  .sim-ent { overflow-y: auto; justify-content: space-between; }
  .sim-saida { overflow-y: auto; }
  .sim-grade { grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .sim-l:nth-child(2) { border-top: 0; }
  .aba-precos { grid-template-rows: auto minmax(0, 1fr); }
  .p-precos { grid-column: 1 / 7; grid-row: 2; }
  .p-fixos { grid-column: 7 / 13; grid-row: 2; }
}
@media (min-width: 1100px) and (max-height: 760px) {
  .sim-ent { gap: 4px; padding: 8px 14px; }
  .sim-campo input { height: 32px; }
  .sim-hero .num { font-size: 32px; }
  .tc-grupo, .tc-linha, .tc-total { padding: 5px 14px; }
}
.painel-custos .kpi .val { font-size: 22px; }
.kpi { min-width: 0; }
.kpi .val { overflow-wrap: anywhere; }
