/* =========================================================================
   Painel oovex — sistema visual "instrumento".
   Princípio: cor é dado. Nenhuma cor decorativa. O que tem cor tem
   significado — etapa do funil, tempo parado, atraso, dinheiro.
   ========================================================================= */

/* Tokens ------------------------------------------------------------------ */
:root {
  color-scheme: light;

  /* Neutros (o painel inteiro vive aqui) */
  --bg: #f1f3f2;
  --surface: #ffffff;
  --well: #e6eae8;
  --raised: #ffffff;
  --ink: #141817;
  --ink-2: #566060;
  --ink-3: #87908c;
  --line: #dbe0dd;
  --line-2: #c3ccc7;
  --focus: #1b6f8c;

  /* Rampa do funil: frio → morno → brasa, e dois estados terminais.
     Vermelho NÃO aparece aqui: fica reservado para atraso. */
  --st-novo: #6b8ba0;
  --st-contatado: #3d8f89;
  --st-raiox: #a8811b;
  --st-proposta: #c15c2b;
  --st-fechado: #2f7d55;
  --st-perdido: #8a7078;

  /* Calor: quanto tempo o lead está parado na etapa */
  --heat-0: #87908c;
  --heat-1: #a3781f;
  --heat-2: #bb5f27;
  --heat-3: #ad392e;

  --alert: #ad392e;
  --ok: #2f7d55;

  --stage: var(--ink-3);
  --heat: var(--heat-0);

  --r: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 23, .06), 0 10px 24px -18px rgba(20, 24, 23, .5);
  --shadow-lift: 0 2px 6px rgba(20, 24, 23, .1), 0 18px 40px -20px rgba(20, 24, 23, .55);

  --ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

/* Escuro: por preferência do sistema, salvo quando o usuário fixou claro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f1211;
    --surface: #171b1a;
    --well: #141817;
    --raised: #1d2221;
    --ink: #e7edea;
    --ink-2: #9aa5a0;
    --ink-3: #6d7773;
    --line: #262c2a;
    --line-2: #363e3b;
    --focus: #58b6d4;

    --st-novo: #90b2c8;
    --st-contatado: #54b6ac;
    --st-raiox: #d0a63c;
    --st-proposta: #e07f4c;
    --st-fechado: #4da572;
    --st-perdido: #a98d95;

    --heat-0: #6d7773;
    --heat-1: #cba03d;
    --heat-2: #dd8050;
    --heat-3: #dd625a;

    --alert: #dd625a;
    --ok: #4da572;

    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 24px -18px rgba(0, 0, 0, .9);
    --shadow-lift: 0 2px 8px rgba(0, 0, 0, .55), 0 18px 40px -20px rgba(0, 0, 0, 1);
  }
}

/* Escuro fixado pelo usuário — precisa vencer a media query acima. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1211;
  --surface: #1c211f;
  --well: #131716;
  --raised: #1d2221;
  --ink: #e7edea;
  --ink-2: #9aa5a0;
  --ink-3: #6d7773;
  --line: #262c2a;
  --line-2: #363e3b;
  --focus: #58b6d4;

  --st-novo: #90b2c8;
  --st-contatado: #54b6ac;
  --st-raiox: #d0a63c;
  --st-proposta: #e07f4c;
  --st-fechado: #4da572;
  --st-perdido: #a98d95;

  --heat-0: #6d7773;
  --heat-1: #cba03d;
  --heat-2: #dd8050;
  --heat-3: #dd625a;

  --alert: #dd625a;
  --ok: #4da572;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 24px -18px rgba(0, 0, 0, .9);
  --shadow-lift: 0 2px 8px rgba(0, 0, 0, .55), 0 18px 40px -20px rgba(0, 0, 0, 1);
}

/* Mapa etapa → cor. Um lugar só, usado por coluna e por card. */
[data-st='novo'] { --stage: var(--st-novo); }
[data-st='contatado'] { --stage: var(--st-contatado); }
[data-st='raiox'] { --stage: var(--st-raiox); }
[data-st='proposta'] { --stage: var(--st-proposta); }
[data-st='fechado'] { --stage: var(--st-fechado); }
[data-st='perdido'] { --stage: var(--st-perdido); }
[data-st='afazer'] { --stage: var(--st-novo); }
[data-st='fazendo'] { --stage: var(--st-raiox); }
[data-st='feito'] { --stage: var(--st-fechado); }

/* Mapa idade → calor. */
[data-heat='0'] { --heat: var(--heat-0); }
[data-heat='1'] { --heat: var(--heat-1); }
[data-heat='2'] { --heat: var(--heat-2); }
[data-heat='3'] { --heat: var(--heat-3); }

/* Base -------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

.hidden { display: none !important; }

body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1 {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h2 {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  margin-bottom: 14px;
}

code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 5px;
}

/* A voz de máquina: tudo que é número, data ou contagem. */
.mono, .money, .age, .col-count, .col-sum, .stat-n, .when, .tl-meta {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* Shell ------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.side {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: baseline; gap: 7px;
  padding: 4px 10px 22px;
  font-size: 20px; font-weight: 600; letter-spacing: -0.035em;
  color: var(--ink);
}
.brand span {
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .18em; color: var(--ink-3);
}

.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav a, .side-foot a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: background .12s, color .12s;
}
.side-nav a:hover, .side-foot a:hover { background: var(--bg); color: var(--ink); }

/* Ativo: marca por barra, não por preenchimento colorido. */
.side-nav a.on { color: var(--ink); font-weight: 600; background: var(--bg); }
.side-nav a.on::before {
  content: ''; width: 3px; height: 15px; border-radius: 2px;
  background: var(--ink); margin-left: -4px; margin-right: 3px;
}
.side-nav a:not(.on)::before { content: ''; width: 3px; margin-left: -4px; margin-right: 3px; }

.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; }
.avatar {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--ink-2);
}
.side-tools { display: flex; align-items: center; gap: 4px; padding: 4px 6px 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: none; border: 1px solid transparent; color: var(--ink-3);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); border-color: var(--line); }
.sair { font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-left: auto; padding: 6px 8px; }

/* min-width:0 deixa o board (kanban largo) rolar dentro da área, em vez de
   empurrar o layout para fora da viewport. */
.main { padding: 28px 30px 64px; min-width: 0; }

/* Cabeçalho de página ----------------------------------------------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head p { color: var(--ink-2); font-size: 14px; margin-top: 5px; max-width: 52ch; }
.back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.back:hover { color: var(--ink); }

/* Botões ------------------------------------------------------------------ */
.btn, label.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  /* Reset explícito: a regra genérica de `label` (mono, caixa alta, coluna)
     vazaria para os botões que são <label>. */
  flex-direction: row; font-family: var(--ui); text-transform: none;
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  padding: 9px 15px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--ink-2); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-perigo { color: var(--alert); }
.btn-perigo:hover { border-color: var(--alert); }

/* Barra de ferramentas do board (busca + filtros) ------------------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.search { position: relative; flex: 1 1 240px; max-width: 320px; }
.search input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none; }
.toolbar select { width: auto; min-width: 130px; }

.toggle {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  flex-direction: row; font-family: var(--ui); text-transform: none;
  font-size: 13px; font-weight: 500; letter-spacing: normal; color: var(--ink-2);
  padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); user-select: none; white-space: nowrap;
}
.toggle input { width: auto; margin: 0; flex: none; accent-color: var(--ink); }
.toggle:hover { border-color: var(--ink-3); color: var(--ink); }

.toolbar-count {
  margin-left: auto; font-family: var(--mono); font-size: 12px;
  color: var(--ink-3); white-space: nowrap;
}

/* Números do dashboard ---------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px;
}
.stat-l {
  font-family: var(--mono); font-size: 10.5px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .13em; color: var(--ink-3);
}
.stat-n {
  display: block; font-size: 30px; font-weight: 500; letter-spacing: -0.03em;
  margin: 8px 0 3px; line-height: 1;
}
.stat-s { font-size: 12.5px; color: var(--ink-2); }

/* Painéis e listas -------------------------------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px;
}
.panel.narrow { max-width: 440px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.list { list-style: none; }
.list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--line); font-size: 14px;
}
.list li:first-child { border-top: none; }
.list .stage-tag { margin-left: auto; }
.empty { color: var(--ink-2); font-size: 13.5px; }

/* Etiqueta de etapa: herda a cor da própria etapa. */
.stage-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
.stage-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--stage);
}

.when { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.when.late { color: var(--alert); font-weight: 500; }

/* Funil do dashboard ------------------------------------------------------ */
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.funnel-step { border-top: 2px solid var(--stage); padding-top: 10px; }
.funnel-n {
  display: block; font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 24px; font-weight: 500; letter-spacing: -0.02em;
}
.funnel-l {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-3);
}

/* Site → funil (visitas do Cloudflare cruzadas com os leads) --------------- */
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin-bottom: 14px; }
.panel-note {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-3);
}

.conv { display: flex; align-items: flex-start; gap: 22px; flex-wrap: wrap; }
.conv-n { display: flex; flex-direction: column; gap: 3px; min-width: 104px; }
.conv-v {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 30px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.05;
  color: var(--ink-2);
}
/* A taxa é a resposta da pergunta; os dois números antes dela são o caminho. */
.conv-forte .conv-v { color: var(--ink); font-weight: 600; }
.conv-l { font-size: 12.5px; color: var(--ink-2); }
.conv-d { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.conv-d.sobe { color: var(--ok); }
.conv-d.desce { color: var(--heat-2); }
.conv-seta {
  font-family: var(--mono); font-size: 14px; color: var(--ink-3);
  align-self: flex-start; margin-top: 12px;
}
/* Mesma régua das colunas do Pipeline, aqui na escala de 0 a 100%. */
.conv-bar {
  display: block; height: 2px; width: 100%; max-width: 132px; margin-top: 8px;
  background: var(--line-2); border-radius: 2px; overflow: hidden;
}
.conv-bar i { display: block; height: 100%; background: var(--ink); border-radius: 2px; }
.conv-aviso {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2);
}

@media (max-width: 560px) {
  .conv-seta { display: none; }
  .conv { gap: 14px; }
}

/* Board / kanban ---------------------------------------------------------- */
.board {
  display: grid; grid-template-columns: repeat(6, minmax(198px, 1fr));
  gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: start;
}
.board-3 { grid-template-columns: repeat(3, minmax(260px, 1fr)); max-width: 1000px; }

.col {
  background: var(--well); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 8px;
  display: flex; flex-direction: column; min-height: 130px;
}

.col-head { padding: 4px 6px 9px; }
.col-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.col-name {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2);
}
.col-count { font-size: 11px; color: var(--ink-3); }
.col-sum {
  display: block; font-size: 13px; font-weight: 500; color: var(--ink);
  margin-top: 3px; letter-spacing: -0.01em;
}
.col-sum.zero { color: var(--ink-3); font-weight: 400; }

/* Assinatura: a régua sob o título da coluna é preenchida pela fatia que
   aquela etapa representa do valor total do funil. Estrutura = informação. */
.col-bar { height: 2px; background: var(--line-2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.col-bar i {
  display: block; height: 100%; background: var(--stage); border-radius: 2px;
  width: var(--pct, 0%); transition: width .3s ease;
}

.col-body {
  display: flex; flex-direction: column; gap: 7px; flex: 1;
  border-radius: var(--r); padding: 2px; min-height: 60px;
  transition: background .12s, box-shadow .12s;
}
.col-body.over {
  background: color-mix(in srgb, var(--stage) 12%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--stage);
}
.col-empty {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  text-align: center; padding: 14px 4px; letter-spacing: .05em;
}

/* Card -------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 11px 10px 17px;
  transition: border-color .12s, box-shadow .12s;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.card-top { display: flex; align-items: flex-start; gap: 6px; }
.card-title { font-size: 14px; font-weight: 600; letter-spacing: -0.012em; flex: 1; }
/* O card inteiro abre o lead; o × e o punho ficam por cima. */
.card-title.stretch::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: var(--r); }
.card-sub { font-size: 12px; color: var(--ink-2); margin-top: 1px; }

.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.chip {
  font-size: 11px; color: var(--ink-2); background: var(--bg);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.money { font-size: 12.5px; font-weight: 500; color: var(--ink); margin-left: auto; white-space: nowrap; }
.card-meta .age { margin-left: auto; }

/* Seletor de status dentro do card: o segundo caminho para mudar de coluna,
   para quem não quer (ou não consegue) arrastar. z-index acima do link
   esticado, senão clicar nele abriria a tarefa em vez de abrir o menu. */
.card-select {
  position: relative; z-index: 2;
  width: auto; max-width: 100%;
  font-family: var(--ui); font-size: 11.5px; font-weight: 500;
  padding: 3px 21px 3px 8px;
  border: 1px solid transparent; border-radius: 6px;
  background-color: var(--bg); color: var(--ink-2);
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%238b9490' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
  transition: border-color .12s, color .12s, background-color .12s;
}
.card-select:hover { border-color: var(--line-2); color: var(--ink); }
.card-select:focus { border-color: var(--focus); box-shadow: none; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
}
.owner { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.owner .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); flex: none; }
.owner.none { color: var(--ink-3); }
.owner.none .dot { background: none; box-shadow: inset 0 0 0 1px var(--ink-3); }
.foot-right { display: inline-flex; align-items: center; gap: 9px; margin-left: auto; }

/* O contador de idade — o elemento que dá o tom do painel. */
.age { font-size: 11.5px; font-weight: 500; color: var(--heat); white-space: nowrap; }
.age[data-heat='3'] { font-weight: 600; }

.del { position: absolute; top: 6px; right: 6px; z-index: 2; opacity: 0; transition: opacity .12s; }
.card:hover .del, .del:focus-within { opacity: 1; }
.del button {
  border: none; background: none; color: var(--ink-3);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 5px;
}
.del button:hover { color: var(--alert); background: var(--bg); }

/* A espinha colorida da etapa É o punho de arraste: você pega o card pela
   borda que diz em que etapa ele está. touch-action:none fica só aqui, para
   o arraste no celular não brigar com a rolagem da página. */
.grip {
  position: absolute; left: 0; top: 6px; bottom: 6px; width: 12px;
  z-index: 2; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: flex-start;
  background: none; border: none; cursor: grab; font-size: 0; color: transparent;
  touch-action: none; border-radius: var(--r) 0 0 var(--r);
}
.grip::before {
  content: ''; width: 3px; height: 100%; border-radius: 0 3px 3px 0;
  background: var(--stage); transition: width .12s;
}
.card:hover .grip::before, .grip:focus-visible::before { width: 5px; }
.grip:active { cursor: grabbing; }

/* Sem hover (toque): alvo maior e espinha sempre mais visível. */
@media (hover: none) {
  .card { padding-left: 24px; }
  .grip { width: 22px; }
  .grip::before { width: 4px; }
}

.card.dragging { opacity: .35; }
.card.ghost {
  position: fixed; z-index: 60; pointer-events: none; margin: 0;
  box-shadow: var(--shadow-lift); opacity: 1;
  transform: rotate(-1.2deg); cursor: grabbing;
}
.slot {
  border: 1.5px dashed var(--stage); border-radius: var(--r);
  background: color-mix(in srgb, var(--stage) 7%, transparent);
}

/* Adição rápida (checkbox + label, sem JS) -------------------------------- */
.quick { position: relative; }
.quick-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.quick-toggle:focus-visible + label.btn { outline: 2px solid var(--focus); outline-offset: 2px; }
.quick-form {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 310px;
  background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift); padding: 14px;
  display: none; flex-direction: column; gap: 9px;
}
.quick-toggle:checked ~ .quick-form { display: flex; }

/* Formulários ------------------------------------------------------------- */
input, select, textarea {
  font-family: var(--ui); font-size: 13.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 8px 11px; width: 100%; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input[type='date'], input[type='number'] { font-family: var(--mono); }
input:focus, select:focus, textarea:focus {
  border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { resize: vertical; font-size: 13.5px; }

label {
  display: flex; flex-direction: column; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
}
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.grid-form button { grid-column: 1 / -1; justify-self: start; }
.grid-form .wide { grid-column: 1 / -1; }
.stage-form { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.stage-form select { width: auto; }
.stage-form .age { font-size: 12px; }
.note-form { display: flex; gap: 8px; margin-bottom: 16px; align-items: flex-start; }
.note-form textarea { flex: 1; }

/* Detalhe do lead --------------------------------------------------------- */
.kv > div {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.kv > div:first-child { border-top: none; }
.kv dt {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-3); padding-top: 2px;
}
.kv dd { text-align: right; }
/* Só o que é de fato dado de máquina fica em mono. */
.kv dd a[href^='mailto'], .kv dd.mono { font-family: var(--mono); font-size: 13px; }
.msg-box { margin-top: 14px; background: var(--bg); border-radius: var(--r); padding: 13px; font-size: 13.5px; }
.msg-box p { margin-top: 6px; color: var(--ink-2); line-height: 1.55; white-space: pre-wrap; }

/* Timeline ---------------------------------------------------------------- */
.timeline { list-style: none; position: relative; margin-top: 4px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 15px 22px; }
.tl-dot {
  position: absolute; left: 0; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink-3);
}
.tl-estagio .tl-dot, .tl-status .tl-dot { box-shadow: inset 0 0 0 1.5px var(--st-proposta); }
.tl-prazo .tl-dot { box-shadow: inset 0 0 0 1.5px var(--heat-2); }
.tl-dono .tl-dot { box-shadow: inset 0 0 0 1.5px var(--st-contatado); }
.tl-nota .tl-dot { background: var(--ink-3); box-shadow: none; }
.tl-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.tl-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* Avisos e toast ---------------------------------------------------------- */
.alert {
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
  border: 1px solid var(--line-2);
}
.alert.ok { border-color: var(--ok); color: var(--ok); }
.alert.erro { border-color: var(--alert); color: var(--alert); }

.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; padding: 0 16px; width: max-content; max-width: calc(100% - 32px);
}
.toast {
  background: var(--ink); color: var(--bg);
  padding: 10px 15px; border-radius: 9px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lift); animation: toast-in .2s ease;
}
.toast.erro { background: var(--alert); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Login ------------------------------------------------------------------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px 28px; width: 100%; max-width: 340px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.login-brand {
  display: flex; align-items: baseline; gap: 7px;
  font-size: 22px; font-weight: 600; letter-spacing: -0.035em;
}
.login-brand span {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .18em; color: var(--ink-3);
}
.login-sub { color: var(--ink-2); font-size: 13px; margin: -6px 0 6px; }
.login-card .btn { margin-top: 4px; padding: 10px; width: 100%; }

/* Responsivo -------------------------------------------------------------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 30; height: auto;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 2px;
    padding: 10px 14px;
  }
  .brand { padding: 0 12px 0 4px; }
  .side-nav { flex-direction: row; }
  .side-nav a.on::before, .side-nav a:not(.on)::before { display: none; }
  .side-foot {
    margin: 0 0 0 auto; border: none; padding: 0;
    display: flex; align-items: center; gap: 4px;
  }
  .side-foot .me span:not(.avatar) { display: none; }
  .side-tools { padding: 0; }
  .main { padding: 20px 16px 56px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: repeat(2, 1fr); }
  .quick-form { right: auto; left: 0; }
  .toolbar-count { margin-left: 0; width: 100%; }

  /* Colunas viram carrossel com encaixe, em vez de espremer. */
  .board { grid-auto-flow: column; grid-auto-columns: 82vw; grid-template-columns: none;
    scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 12px; }
  .board-3 { grid-auto-columns: 82vw; max-width: none; }
  .col { scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
