/* Koraki CRM — mesmas cores e fonte do site (koraki-site/src/styles/tokens.css). Âmbar só no botão principal. */
@font-face {
  font-family: 'Familjen Grotesk';
  src: url('/fonts/familjen-grotesk-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Familjen Grotesk';
  src: url('/fonts/familjen-grotesk-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --noite: #0c1715;
  --igarape: #0f4d44;
  --verde-agua: #7db5a2;
  --creme: #f2efe7;
  --ambar: #f0a23b;
  --vermelho: #e0715f;
  --bg: var(--noite);
  --surface: color-mix(in srgb, var(--igarape) 38%, var(--noite));
  --surface-2: color-mix(in srgb, var(--igarape) 60%, var(--noite));
  --text: var(--creme);
  --text-muted: color-mix(in srgb, var(--creme) 68%, var(--noite));
  --line: color-mix(in srgb, var(--creme) 14%, transparent);
  --font: 'Familjen Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 12px;
  --radius-sm: 6px;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* o estilo dos botões não pode desfazer o "escondido" */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
}
a { color: var(--verde-agua); text-underline-offset: 0.18em; }
a:hover { color: var(--creme); }
h1, h2 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.3rem); margin-bottom: 1rem; }
h2 { font-size: 1.05rem; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
p { margin: 0 0 0.75rem; }
:focus-visible { outline: 2px solid var(--ambar); outline-offset: 2px; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- topo ---------- */
.topo {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding: calc(0.6rem + env(safe-area-inset-top, 0px)) var(--gutter) 0.6rem;
  background: color-mix(in srgb, var(--noite) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.marca { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--creme); text-decoration: none; font-size: 1.05rem; }
.marca b { font-weight: 600; color: var(--ambar); }
.marca__simbolo { width: 1.6rem; height: 1.6rem; color: var(--ambar); flex: none; }
.marca--grande { font-size: 1.5rem; justify-content: center; margin-bottom: 1.5rem; }
.marca--grande .marca__simbolo { width: 2.4rem; height: 2.4rem; }
.abas { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.abas a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.abas a:hover { color: var(--creme); background: var(--surface); }
.abas a[aria-current='page'] { color: var(--creme); background: var(--surface-2); }
.busca { margin-left: auto; flex: 1 1 14rem; max-width: 22rem; }
.busca input { width: 100%; }
.sair { flex: none; }

/* ---------- base de formulários ---------- */
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--noite);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  min-height: 2.75rem;
  width: 100%;
}
textarea { resize: vertical; min-height: 3rem; }
input:focus, select:focus, textarea:focus { border-color: var(--verde-agua); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde-agua) 25%, transparent); }
label { display: block; font-size: 0.875rem; color: var(--text-muted); margin: 0.25rem 0 0.3rem; }
.form { display: grid; gap: 0.4rem; }
.form .btn { justify-self: start; margin-top: 0.5rem; }
.check { display: flex; align-items: center; gap: 0.5rem; color: var(--text); margin: 0.5rem 0; }
.check input { width: auto; min-height: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  font: 600 0.95rem/1 var(--font);
  color: var(--creme);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--creme) 35%, transparent);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--creme); color: var(--creme); }
.btn--principal { background: var(--ambar); color: var(--noite); border-color: var(--ambar); }
.btn--principal:hover { background: color-mix(in srgb, var(--ambar) 85%, var(--creme)); color: var(--noite); }
.btn--fantasma { border-color: transparent; color: var(--text-muted); padding-inline: 0.75rem; }
.btn--perigo { border-color: var(--vermelho); color: var(--vermelho); }
.btn:disabled { opacity: 0.6; cursor: wait; }

/* ---------- miolo ---------- */
.conteudo { padding: 1.5rem var(--gutter) calc(3rem + env(safe-area-inset-bottom, 0px)); max-width: 90rem; margin: 0 auto; }
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; min-width: 0; }
.titulo-acao { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.dica, .sub, .sobre { color: var(--text-muted); font-size: 0.9rem; }
.sobre { margin-bottom: 0.25rem; }
.sub { margin-top: -0.6rem; }
.aviso { padding: 0.7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid; }
.aviso--ok { border-color: color-mix(in srgb, var(--verde-agua) 60%, transparent); background: color-mix(in srgb, var(--verde-agua) 12%, transparent); }
.aviso--erro { border-color: var(--vermelho); background: color-mix(in srgb, var(--vermelho) 14%, transparent); }
.vazio { color: var(--text-muted); margin: 0.25rem 0; }
.conta { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); background: var(--noite); border-radius: 999px; padding: 0.05rem 0.5rem; }
.selo { display: inline-block; min-width: 1.3rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--verde-agua); color: var(--noite); font-size: 0.75rem; font-weight: 700; text-align: center; line-height: 1.3; }
.atrasado { color: var(--ambar); }

/* listas */
.lista { list-style: none; margin: 0; padding: 0; }
.linha + .linha { border-top: 1px solid var(--line); }
.linha a, .linha--fixa {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'nome lado' 'info lado';
  gap: 0.1rem 1rem;
  padding: 0.65rem 0.25rem;
  color: var(--text);
  text-decoration: none;
  align-items: center;
}
.linha a:hover { background: color-mix(in srgb, var(--creme) 5%, transparent); }
.linha__nome { grid-area: nome; font-weight: 600; overflow-wrap: anywhere; }
.linha__info { grid-area: info; color: var(--text-muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linha__lado { grid-area: lado; color: var(--text-muted); font-size: 0.85rem; text-align: right; display: flex; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.linha--nova .linha__info { color: var(--text); }
.fechada { font-size: 0.7rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 0.3rem; }
.lista--conversas .linha a { padding-block: 0.8rem; }

.grade-hoje { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.grade--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-hoje > .cartao { display: flex; flex-direction: column; }
@media (max-width: 1100px) { .grade-hoje { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grade-hoje, .grade--2 { grid-template-columns: minmax(0, 1fr); } }

.busca-grande { display: flex; gap: 0.5rem; max-width: 36rem; margin-bottom: 1rem; }

/* etapas */
.etapa { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--surface-2); }
.etapa--fechado { background: color-mix(in srgb, var(--verde-agua) 30%, var(--noite)); }
.etapa--perdido { background: color-mix(in srgb, var(--vermelho) 25%, var(--noite)); }

/* ---------- funil ---------- */
.funil {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15rem, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x proximity;
}
.coluna { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; scroll-snap-align: start; display: flex; flex-direction: column; min-height: 12rem; }
.coluna.alvo { border-color: var(--verde-agua); background: var(--surface-2); }
.coluna__topo { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.coluna__topo h2 { margin: 0; font-size: 0.95rem; }
.coluna__total { margin-left: auto; font-size: 0.8rem; color: var(--text-muted); }
.coluna__cartoes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; align-content: start; flex: 1; }
.cartao-lead { background: var(--noite); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: grab; }
.cartao-lead.arrastando { opacity: 0.45; }
.cartao-lead a { display: grid; gap: 0.15rem; padding: 0.6rem 0.7rem; color: var(--text); text-decoration: none; }
.cartao-lead__nome { font-weight: 600; overflow-wrap: anywhere; }
.cartao-lead__info { font-size: 0.85rem; color: var(--text-muted); }
.cartao-lead__pe { display: flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.cartao-lead__pe:empty { display: none; }

/* ---------- lead ---------- */
.grade-lead { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.lado { display: grid; gap: 1rem; min-width: 0; }
.conversa { display: flex; flex-direction: column; position: sticky; top: 5rem; max-height: calc(100dvh - 6.5rem); }
.janela { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.5rem; }
.janela--aberta { color: var(--verde-agua); border-color: color-mix(in srgb, var(--verde-agua) 50%, transparent); }
.bolhas { list-style: none; margin: 0 -0.4rem; padding: 0.25rem 0.4rem; overflow-y: auto; flex: 1; min-height: 12rem; display: flex; flex-direction: column; gap: 0.35rem; }
.bolha { max-width: 82%; padding: 0.5rem 0.7rem 0.35rem; border-radius: 12px; background: var(--noite); border: 1px solid var(--line); align-self: flex-start; }
.bolha--saida { align-self: flex-end; background: color-mix(in srgb, var(--igarape) 85%, var(--noite)); border-color: transparent; }
.bolha p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bolha__pe { display: block; text-align: right; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.bolha__erro { display: block; font-size: 0.78rem; color: var(--vermelho); }
.tique--lida { color: var(--verde-agua); }
.tique--falhou { color: var(--vermelho); font-weight: 700; }
.dia { align-self: center; font-size: 0.72rem; color: var(--text-muted); margin: 0.4rem 0; }
.envio { display: flex; gap: 0.5rem; align-items: flex-end; margin-top: 0.75rem; }
.envio textarea { flex: 1; }
.nota-envio { margin-top: 0.75rem; padding: 0.75rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.92rem; }
.nota-envio p { margin-bottom: 0.5rem; }
.nota-envio form { margin-bottom: 0.5rem; }

.campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.75rem; }
.campo--largo { grid-column: 1 / -1; }
.nota-form { margin-bottom: 0.75rem; }
.notas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; max-height: 28rem; overflow-y: auto; }
.nota { padding: 0.5rem 0.6rem; border-left: 3px solid var(--verde-agua); background: var(--noite); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.nota p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.nota span { font-size: 0.75rem; color: var(--text-muted); }
.nota--evento { border-left-color: var(--line); background: transparent; }
.nota--evento p { color: var(--text-muted); font-size: 0.88rem; }
.perigo summary { cursor: pointer; color: var(--text-muted); }
.perigo[open] summary { margin-bottom: 0.75rem; }

/* ---------- entrar ---------- */
.tela-login .conteudo { min-height: 100dvh; display: grid; place-items: center; }
.login { width: min(100%, 24rem); }
.login .form .btn { justify-self: stretch; }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .grade-lead { grid-template-columns: 1fr; }
  .conversa { position: static; max-height: none; }
  .bolhas { max-height: 60vh; }
}
@media (max-width: 640px) {
  .topo { gap: 0.5rem; }
  .abas { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .busca { order: 2; max-width: none; flex-basis: 100%; margin-left: 0; }
  .sair { margin-left: auto; }
  .campos { grid-template-columns: 1fr; }
  .funil { grid-auto-columns: 82%; }
  .bolha { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* ---------- acréscimos: atenção, projetos, insights, monitor ---------- */
.selo--alerta { background: var(--vermelho); color: var(--noite); }
.btn--mini { min-height: 2.25rem; padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.cartao--alerta { border-color: var(--vermelho); background: color-mix(in srgb, var(--vermelho) 12%, var(--surface)); margin-bottom: 1rem; }
.cartao--destaque { border-color: color-mix(in srgb, var(--ambar) 70%, transparent); margin-bottom: 1rem; }
.alertas { margin: 0 0 0.75rem; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.alerta-txt { color: var(--vermelho); }
.linha--acao { display: flex; align-items: center; gap: 0.5rem; }
.linha--acao > a:first-child { flex: 1; min-width: 0; }
.passo { margin: -0.25rem 0 0.75rem; padding: 0.45rem 0.7rem; border-left: 3px solid var(--ambar); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.filtros { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.filtros label { margin: 0; }
.filtros select { width: auto; min-width: 12rem; }
.filtros__extra { margin-left: auto; font-size: 0.9rem; }
.envio { flex-wrap: wrap; }
.envio__rapida { flex-basis: 100%; }
.estreito { max-width: 32rem; margin-top: 1rem; }
.botoes { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.botoes form { margin: 0; }
.funil--projetos { grid-auto-columns: minmax(13rem, 1fr); }
.etapa--p-aprovado, .etapa--p-entregue { background: color-mix(in srgb, var(--verde-agua) 30%, var(--noite)); }
.etapa--p-ajustes { background: color-mix(in srgb, var(--ambar) 30%, var(--noite)); }
.aprovacoes { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.4rem; }
.aprov { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); background: var(--noite); border-left: 3px solid var(--line); }
.aprov p { grid-column: 1 / -1; margin: 0.2rem 0 0; white-space: pre-wrap; }
.aprov__nome { font-weight: 600; }
.aprov__quando { grid-column: 1 / -1; font-size: 0.75rem; color: var(--text-muted); }
.aprov--ok { border-left-color: var(--verde-agua); }
.aprov--ok .aprov__estado { color: var(--verde-agua); }
.aprov--ajustar { border-left-color: var(--ambar); }
.aprov--ajustar .aprov__estado { color: var(--ambar); }
.aprov--pendente .aprov__estado { color: var(--text-muted); }
.placar { color: var(--text-muted); }
.decisao { margin-top: 0.75rem; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; display: grid; gap: 0.15rem; align-content: start; }
.kpi dt { font-size: 0.85rem; color: var(--text-muted); }
.kpi dd { margin: 0.1rem 0; font-size: clamp(1.15rem, 0.9rem + 0.9vw, 1.55rem); overflow-wrap: anywhere; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi__det { font-size: 0.8rem; color: var(--text-muted); }
.kpi__det.sobe, .kpi__det.desce { color: var(--text); }
.barras { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.barras li { display: grid; grid-template-columns: 8.5rem minmax(3rem, 1fr) 9.5rem; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
@media (max-width: 700px) { .barras li { grid-template-columns: 6.5rem minmax(2.5rem, 1fr) 7.5rem; gap: 0.5rem; font-size: 0.85rem; } }
.barras__rotulo { color: var(--text-muted); overflow-wrap: anywhere; }
.barras__trilho { width: 100%; height: 0.5rem; display: block; }
.barras__valor { font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; line-height: 1.25; }
.trilho { fill: var(--noite); }
.barra { fill: var(--verde-agua); }
.grafico { margin: 0; }
.grafico svg { width: 100%; height: auto; max-height: 12rem; display: block; overflow: visible; }
.grafico .base { stroke: var(--line); stroke-width: 1; }
.alvo-g { fill: transparent; }
.coluna-g:hover .alvo-g { fill: color-mix(in srgb, var(--creme) 6%, transparent); }
.valor-g { fill: var(--text); font-size: 11px; font-family: var(--font); }
.eixo-g { fill: var(--text-muted); font-size: 10px; font-family: var(--font); }
.tabela { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tabela th, .tabela td { text-align: left; padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabela thead th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; }
.tabela td { font-variant-numeric: tabular-nums; }
.tabela-rolar { position: relative; overflow-x: auto; max-width: 100%; margin: 0 0 1rem; } /* relative: o texto só para leitor de tela não escapa da rolagem */
.tabela--sites { min-width: 56rem; }
.linha-alerta th, .linha-alerta td { background: color-mix(in srgb, var(--vermelho) 10%, transparent); }
.linha-pausada { opacity: 0.55; }
.sub-url { display: block; font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.status { font-weight: 600; white-space: nowrap; }
.status::before { content: ''; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.4rem; background: var(--text-muted); }
.status--ok::before { background: var(--verde-agua); }
.status--lento::before { background: var(--ambar); }
.status--fora { color: var(--vermelho); }
.status--fora::before { background: var(--vermelho); }
.faixa { width: 11rem; height: 1rem; display: block; }
.f-ok { fill: var(--verde-agua); }
.f-lento { fill: var(--ambar); }
.f-fora { fill: var(--vermelho); }
.acoes-site { display: flex; gap: 0.4rem; align-items: flex-start; }
.acoes-site details { min-width: 0; }
.acoes-site summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; padding: 0.4rem 0.2rem; }
.acoes-site details[open] { position: relative; }
.acoes-site details[open] > :not(summary) { min-width: 16rem; }
.quedas { margin: 0; padding-left: 1rem; font-size: 0.8rem; }
.form--linha { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.form--linha .campo { flex: 1 1 14rem; }
@media (forced-colors: active) {
  .barra, .f-ok, .f-lento, .f-fora { fill: CanvasText; }
}

/* ---------- fila Hoje ---------- */
.fila { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.fila__atual { border-color: color-mix(in srgb, var(--ambar) 55%, transparent); padding: 1.4rem 1.5rem; }
.fila__atual h2 { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.7rem); margin: 0.35rem 0 0.6rem; }
.fila__atual textarea { margin-bottom: 0.25rem; }
.fila__tipo { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 0; }
.fila__tipo--responder { color: var(--ambar); }
.fila__tipo--aprovar { color: var(--verde-agua); }
.porque { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.porque li { font-size: 0.85rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--noite); border: 1px solid var(--line); }
.porque li:first-child { border-color: color-mix(in srgb, var(--ambar) 60%, transparent); }
.linha--fila .linha__nome .fila__tipo { margin-right: 0.35rem; }
.fila__lista { max-height: 70vh; overflow-y: auto; }
.fila-vazia { max-width: 36rem; }
.sugestao { padding: 0.6rem 0.8rem; border: 1px solid color-mix(in srgb, var(--verde-agua) 60%, transparent); border-radius: var(--radius-sm); margin: 0 0 0.75rem; background: color-mix(in srgb, var(--verde-agua) 10%, transparent); }
.sugestao p { margin: 0; }
.sugestao .botoes { margin-top: 0.5rem; }
@media (max-width: 900px) { .fila { grid-template-columns: 1fr; } }

/* ---------- arrumação geral ---------- */
.abas { scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.cartao { min-width: 0; }
.conteudo > .cartao + .cartao, .conteudo > .grade-hoje + .cartao, .conteudo > .cartao + .grade-hoje { margin-top: 1rem; }
.kpis + .grade-hoje { margin-top: 0; }
.lado > .cartao, .grade-lead > .cartao { min-width: 0; }
.grafico figcaption { margin-top: 0.5rem; }
.linha__lado form { margin: 0; }
.linha--fixa .linha__lado { flex-wrap: wrap; }
@media (max-width: 640px) {
  .topo [data-avisos] { order: 1; margin-left: auto; padding-inline: 0.5rem; }
  .topo .sair { order: 1; margin-left: 0; }
  .topo [data-avisos]:not([hidden]) + .sair { margin-left: 0; }
  .titulo-acao h1 { margin-bottom: 0.5rem; }
  .fila__atual { padding: 1.1rem; }
  .botoes .btn { flex: 1 1 auto; }
}
.tabela-rolar, .funil, .bolhas, .notas, .fila__lista { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--creme) 22%, transparent) transparent; }

/* ---------- funil: 6 etapas em andamento cabem na tela; fechado/pausado/perdido numa faixa embaixo ---------- */
.funil { display: grid; gap: 0.75rem; overflow: visible; padding: 0; grid-auto-flow: row; grid-auto-columns: auto; scroll-snap-type: none; }
.funil__quadro { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(12rem, 1fr); gap: 0.6rem; overflow-x: auto; padding-bottom: 0.4rem; scroll-snap-type: x proximity; }
.funil__fim { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.funil .coluna { padding: 0.65rem; min-height: 14rem; }
.funil .coluna--compacta { min-height: 7rem; background: color-mix(in srgb, var(--surface) 70%, var(--noite)); }
.funil .coluna__topo { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'nome conta' 'total total'; gap: 0.1rem 0.5rem; margin-bottom: 0.55rem; }
.funil .coluna__topo h2 { grid-area: nome; font-size: 0.9rem; }
.funil .coluna__topo .conta { grid-area: conta; justify-self: end; }
.funil .coluna__total { grid-area: total; margin: 0; min-height: 1.1em; font-size: 0.78rem; }
.funil .coluna--compacta .coluna__cartoes { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.coluna--ganha { border-color: color-mix(in srgb, var(--verde-agua) 45%, transparent); }
.coluna--perdida .cartao-lead { opacity: 0.8; }
.funil .cartao-lead a { padding: 0.5rem 0.6rem; gap: 0.1rem; }
.funil .cartao-lead__nome { font-size: 0.92rem; line-height: 1.3; }
.funil .cartao-lead__info { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funil .cartao-lead__pe { align-items: center; margin-top: 0.3rem; gap: 0.25rem 0.5rem; }
.cartao-lead__valor { color: var(--text); font-weight: 600; }
.cartao-lead__resp { margin-left: auto; width: 1.35rem; height: 1.35rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); font-size: 0.7rem; font-weight: 700; }
.coluna__mais { margin: 0.4rem 0 0; font-size: 0.78rem; }
@media (max-width: 900px) {
  .funil__quadro { grid-auto-columns: minmax(78%, 1fr); }
  .funil__fim { grid-template-columns: minmax(0, 1fr); }
}
.funil__quadro { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--creme) 22%, transparent) transparent; }
.funil.funil--projetos { grid-auto-flow: column; grid-auto-columns: minmax(12rem, 1fr); overflow-x: auto; padding-bottom: 0.4rem; }
@media (max-width: 900px) { .funil.funil--projetos { grid-auto-columns: minmax(78%, 1fr); } }
.whatsapp { margin-bottom: 1rem; }
.whatsapp .status { margin-bottom: 0.5rem; }
.passos { margin: 0 0 0.75rem; padding-left: 1.2rem; display: grid; gap: 0.25rem; }
.qr { display: block; width: 264px; height: 264px; max-width: 100%; border-radius: var(--radius-sm); background: #fff; padding: 8px; image-rendering: pixelated; }
.kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#financeiro details { margin-top: 0.6rem; }
#financeiro details > summary.btn { list-style: none; display: inline-flex; }
#financeiro details > summary::-webkit-details-marker { display: none; }
#financeiro details[open] > summary { margin-bottom: 0.5rem; }
.linha--cobranca .linha__nome a { color: var(--text); }
.envio__nota { flex-basis: 100%; margin: 0; font-size: 0.8rem; }

/* ---------- ficha do lead estilo WhatsApp Web: conversa em altura de tela + painel com abas ---------- */
.lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(19rem, 24rem); gap: 1rem; height: calc(100dvh - 7.25rem); min-height: 32rem; margin-top: -0.5rem; }
.lead--com-lista { grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr) minmax(19rem, 23rem); }
.lead__lista, .chat, .painel { min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.lead__lista { overflow-y: auto; padding: 0.5rem; }
.lead__lista-titulo { margin: 0.25rem 0.4rem 0.5rem; font-weight: 600; }
.lead__lista-titulo a { color: var(--text); text-decoration: none; }
.lead__lista .linha a { padding: 0.6rem 0.5rem; border-radius: var(--radius-sm); }
.linha--atual a { background: var(--surface-2); }
.chat { display: flex; flex-direction: column; overflow: hidden; }
.chat__topo { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat__quem { flex: 1 1 12rem; min-width: 0; }
.chat__quem h1 { font-size: 1.15rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__quem .sub { margin: 0.1rem 0 0; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--igarape); color: var(--creme); font-weight: 700; }
.etapa-rapida { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.etapa-rapida select { width: auto; min-height: 2.25rem; padding-block: 0.3rem; font-size: 0.9rem; }
.chat__avisos { padding: 0.6rem 1rem 0; display: grid; gap: 0.5rem; }
.chat__avisos > * { margin: 0; }
.chat .bolhas { flex: 1; min-height: 0; max-height: none; margin: 0; padding: 1rem 1.25rem; gap: 0.4rem; background: color-mix(in srgb, var(--noite) 55%, var(--surface)); }
.chat .bolha { max-width: min(68%, 36rem); }
.chat .bolha--entrada { background: var(--surface-2); border-color: transparent; border-top-left-radius: 4px; }
.chat .bolha--saida { background: color-mix(in srgb, var(--igarape) 95%, var(--verde-agua)); border-top-right-radius: 4px; }
.chat .dia span { background: var(--surface); padding: 0.15rem 0.6rem; border-radius: 999px; }
.chat__envio { padding: 0.6rem 0.8rem 0.75rem; border-top: 1px solid var(--line); }
.chat__envio .envio { margin: 0; align-items: flex-end; }
.chat__envio textarea { min-height: 2.75rem; max-height: 10rem; }
.chat__envio .nota-envio { margin: 0; }
.painel { display: flex; flex-direction: column; overflow: hidden; }
.painel__abas { display: flex; gap: 0.15rem; padding: 0.4rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.painel__abas button { font: 600 0.82rem/1 var(--font); color: var(--text-muted); background: none; border: 0; border-radius: 999px; padding: 0.5rem 0.7rem; cursor: pointer; white-space: nowrap; }
.painel__abas button:hover { color: var(--text); }
.painel__abas button[aria-selected='true'] { color: var(--creme); background: var(--surface-2); }
.painel__aba { overflow-y: auto; padding: 0.9rem 1rem 1rem; flex: 1; min-height: 0; }
.painel__abas:not([hidden]) ~ .painel__aba .painel__titulo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.painel .campos { grid-template-columns: 1fr; }
.painel .cartao { border: 0; padding: 0; background: none; }
.painel .notas { max-height: none; }
.painel .perigo { margin-top: 1rem; }
.resumo { margin: 0 0 1rem; display: grid; gap: 0.1rem; }
.resumo__item { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.resumo__item dt { color: var(--text-muted); }
.resumo__item dd { margin: 0; overflow-wrap: anywhere; }
.resumo__item.atrasado dd { color: var(--ambar); }
@media (max-width: 1200px) { .lead--com-lista { grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem); } .lead__lista { display: none; } }
@media (max-width: 900px) {
  .lead, .lead--com-lista { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat { height: 78dvh; }
  .painel { max-height: none; }
  .painel__aba { overflow: visible; }
}
/* topo numa linha só até telas médias; a ficha ocupa exatamente a altura que sobra (--topo vem do app.js) */
.lead { height: calc(100dvh - var(--topo, 4.5rem) - 3rem); }
@media (max-width: 1440px) and (min-width: 641px) {
  .topo { gap: 0.5rem 0.75rem; }
  .abas a { padding: 0.45rem 0.55rem; font-size: 0.92rem; }
  .busca { flex: 1 1 9rem; max-width: 15rem; }
  .marca span { display: none; }
}
@media (max-width: 1100px) and (min-width: 641px) {
  .busca { order: 4; flex-basis: 100%; max-width: none; }
}
@media (max-width: 640px) {
  .chat__topo { gap: 0.5rem; padding: 0.6rem 0.75rem; }
  .chat__topo > .btn { display: none; }
  .etapa-rapida select { max-width: 8.5rem; }
}
.chat__quem { flex: 1 1 8rem; }
.chat__topo > .btn { flex: none; }

/* ========== celular: cara de app (topo enxuto + barra fixa embaixo) ========== */
.barra-inferior, .so-celular { display: none; }
.topo__icone { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; color: var(--text); border-radius: 50%; }
.topo__icone svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 640px) {
  .topo { flex-wrap: nowrap; padding-block: calc(0.4rem + env(safe-area-inset-top, 0px)) 0.4rem; }
  .topo .abas, .topo .busca, .topo .sair, .topo [data-avisos] { display: none; }
  .topo .marca span { display: inline; }
  .so-celular { display: grid; }
  .topo__icone { margin-left: auto; }
  .barra-inferior {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
    padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--noite) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  }
  .barra-inferior a { position: relative; display: grid; justify-items: center; gap: 0.15rem; padding: 0.35rem 0 0.25rem; min-height: 3.1rem; color: var(--text-muted); text-decoration: none; font-size: 0.68rem; border-radius: var(--radius-sm); }
  .barra-inferior svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
  .barra-inferior a[aria-current='page'] { color: var(--creme); }
  .barra-inferior a[aria-current='page'] svg { stroke: var(--ambar); }
  .barra-inferior .selo { position: absolute; top: 0.1rem; left: calc(50% + 0.35rem); font-size: 0.65rem; min-width: 1.1rem; }
  .conteudo { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); padding-top: 1rem; }
  h1 { font-size: 1.6rem; }
  /* iPhone dá zoom ao tocar em campo com letra menor que 16 px */
  input, select, textarea { font-size: 16px; }
  .etapa-rapida select { font-size: 16px; }
  /* colunas vazias do funil e dos projetos não ocupam a tela */
  .funil .coluna, .funil.funil--projetos .coluna { min-height: 0; }
  .funil .coluna__cartoes:empty::after { content: 'Vazio'; display: block; color: var(--text-muted); font-size: 0.8rem; padding: 0.25rem 0; }
  .funil .coluna--compacta { min-height: 0; }
  .funil__fim { gap: 0.5rem; }
  .filtros select { min-width: 0; flex: 1; }
  .filtros__extra { margin-left: 0; }
  /* ficha do lead: conversa ocupa a tela até a barra de baixo */
  .lead { margin-top: -0.25rem; }
  .chat { height: calc(100dvh - var(--topo, 3.5rem) - 9.5rem - env(safe-area-inset-bottom, 0px)); min-height: 22rem; }
  .painel__aba { padding-inline: 0.85rem; }
  /* valores a receber */
  .linha--cobranca { grid-template-columns: 1fr auto; }
  .linha--cobranca .linha__nome { white-space: normal; }
  .fila__atual .botoes .btn { flex: 1 1 calc(50% - 0.5rem); }
}
@media (display-mode: standalone) and (max-width: 640px) {
  .topo { padding-top: calc(0.5rem + env(safe-area-inset-top, 0px)); }
}
