:root {
  --amarelo: #EFDF00;
  --amarelo-escuro: #C9BB00;
  --preto: #111214;
  --sidebar: #141518;
  --sidebar-hover: #1f2125;
  --sidebar-texto: #a9adb5;
  --fundo: #f4f5f7;
  --superficie: #ffffff;
  --borda: #e6e8ec;
  --borda-forte: #d5d8de;
  --texto: #1b1d22;
  --texto-2: #565b66;
  --muted: #8a8f99;
  --barra: #2b2e35;
  --barra-hover: #000000;
  --perigo: #d13b3b;
  --sucesso: #1f8a52;
  --raio: 14px;
  --sombra: 0 1px 2px rgba(16, 18, 22, .04), 0 4px 16px rgba(16, 18, 22, .05);

  /* Status */
  --st-primeiro-bg: #eaf1ff; --st-primeiro: #2856c7;
  --st-tratativa-bg: #fff4dc; --st-tratativa: #9a6200;
  --st-encaminhado-bg: #e3f6ea; --st-encaminhado: #1b7a48;
  --st-finalizado-bg: #eceef1; --st-finalizado: #5f6570;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* Reserva o espaço da barra de rolagem (sem desenhá-la quando não há o que rolar):
   a página não "pula" quando um filtro deixa a lista curta. */
html { overflow-y: auto; scrollbar-gutter: stable; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.muted { color: var(--muted); margin: 0; }

/* ---------- Marca ---------- */
.marca { display: flex; align-items: center; gap: 12px; padding: 4px 6px 22px; }
.marca strong { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.marca small { color: var(--sidebar-texto); font-size: 12px; }
.logo-marca { height: 38px; width: auto; flex: none; }

/* ---------- Login ---------- */
/* No login a página não rola: ocupa exatamente a janela (sem barra nem espaço reservado para ela). */
html:has(#tela-login:not([hidden])) { overflow: hidden; scrollbar-gutter: auto; background: #fff; }
html:has(#tela-login:not([hidden])) body { background: #fff; }

/* Duas metades: vitrine escura (apresentação) + painel branco com o formulário. */
.login { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(400px, 1fr); background: #fff; }

/* Vitrine */
.login-vitrine {
  position: relative; overflow: hidden; color: #fff; padding: 40px 56px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 36px;
  background:
    radial-gradient(700px 420px at 85% 15%, rgba(239, 223, 0, .16), transparent 60%),
    radial-gradient(600px 500px at 0% 100%, rgba(239, 223, 0, .07), transparent 60%),
    linear-gradient(160deg, #1c1d21 0%, #0d0e10 70%);
}
/* Losangos decorativos, eco do logo Renault */
.login-vitrine::before, .login-vitrine::after {
  content: ''; position: absolute; border: 1px solid rgba(239, 223, 0, .14); transform: rotate(45deg); pointer-events: none;
}
.login-vitrine::before { width: 420px; height: 420px; right: -170px; top: -150px; }
.login-vitrine::after { width: 260px; height: 260px; right: -60px; top: -40px; border-color: rgba(255, 255, 255, .06); }
.vitrine-topo { display: flex; align-items: center; gap: 18px; position: relative; }
.vitrine-logo { height: 46px; width: auto; }
.vitrine-logo-best { height: 38px; width: auto; }
.vitrine-divisor { width: 1px; height: 34px; background: rgba(255, 255, 255, .22); }
.vitrine-meio { position: relative; max-width: 560px; }
.vitrine-selo {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(239, 223, 0, .35); background: rgba(239, 223, 0, .08);
  color: var(--amarelo); border-radius: 99px; padding: 5px 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.vitrine-selo i { width: 7px; height: 7px; border-radius: 50%; background: var(--amarelo); box-shadow: 0 0 0 4px rgba(239, 223, 0, .18); }
.vitrine-meio h2 { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.15; font-weight: 700; margin: 18px 0 12px; letter-spacing: -.02em; }
.vitrine-meio h2 em { font-style: normal; color: var(--amarelo); }
.vitrine-meio p { color: #b9bdc5; font-size: 15px; line-height: 1.6; margin: 0 0 28px; max-width: 480px; }

/* Ficha de lead ilustrativa */
.vitrine-card {
  background: #fff; color: var(--texto); border-radius: 16px; padding: 18px 20px; max-width: 470px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06); transform: rotate(-1.2deg);
}
.vc-cab { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.vc-cab strong { display: block; font-size: 15px; }
.vc-cab small { color: var(--muted); font-size: 12px; }
.vc-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--amarelo); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.vc-pill { margin-left: auto; border-radius: 99px; padding: 4px 11px; font-size: 11.5px; font-weight: 600; }
.vc-verde { background: var(--st-encaminhado-bg); color: var(--st-encaminhado); }
.vc-linhas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 0; }
.vc-linhas small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 4px; }
.vc-linhas span { font-size: 13.5px; font-weight: 500; }
.vc-tag { display: inline-block; background: #f0f1f4; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; color: var(--texto-2); }
.vc-amarela { background: #fff7c2; color: #6b6200; }
.vc-obs { display: flex; align-items: center; gap: 10px; background: #f6f7f9; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--texto-2); }
.vc-obs i { width: 10px; height: 10px; border-radius: 50%; background: var(--amarelo); border: 2px solid var(--preto); flex: none; }

.vitrine-recursos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; position: relative; }
.vitrine-recursos li { border-top: 2px solid rgba(239, 223, 0, .5); padding-top: 12px; color: #9ea3ac; font-size: 12.5px; line-height: 1.45; }
.vitrine-recursos b { display: block; color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 2px; }

/* Painel do formulário */
.login-painel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 32px 24px; position: relative; }
.login-caixa { width: 100%; max-width: 380px; margin: auto 0; }
.login-marca { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; }
.login-marca-logo { height: 40px; width: auto; filter: invert(1); }
.login-marca strong { display: block; font-size: 15px; font-weight: 700; }
.login-marca small { color: var(--muted); font-size: 12.5px; }
.login-titulo { font-size: 32px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.login-sub { color: var(--texto-2); font-size: 15px; margin: 6px 0 30px; }
.login-form { display: grid; gap: 18px; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--texto); }
.login-form input { padding: 13px 16px; border-radius: 12px; font-size: 15px; background: #fafbfc; }
.login-form input:focus { background: #fff; }
.campo-senha { position: relative; display: block; }
.campo-senha input { padding-right: 48px; }
.ver-senha {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.ver-senha:hover { background: #f0f1f4; color: var(--texto); }
.ver-senha svg { width: 18px; height: 18px; }
.login-entrar { width: 100%; padding: 14px; border-radius: 12px; font-size: 15px; margin-top: 6px; }
.login-ajuda { color: var(--muted); font-size: 13px; margin: 22px 0 0; text-align: center; }
.login-rodape { color: #b0b4bc; font-size: 12px; margin: 24px 0 0; letter-spacing: .02em; }

/* Telas mais baixas (notebooks): vitrine e formulário mais compactos, para caber sem rolar. */
@media (max-height: 780px) {
  .login-vitrine { padding: 28px 48px; gap: 20px; }
  .vitrine-logo { height: 38px; }
  .vitrine-logo-best { height: 32px; }
  .vitrine-meio h2 { font-size: clamp(24px, 2.3vw, 32px); margin: 14px 0 10px; }
  .vitrine-meio p { font-size: 14px; margin-bottom: 20px; }
  .vitrine-card { padding: 14px 18px; }
  .vc-cab { padding-bottom: 10px; }
  .vc-linhas { padding: 10px 0; }
  .login-painel { padding: 24px 32px 16px; }
  .login-marca { margin-bottom: 28px; }
  .login-sub { margin-bottom: 22px; }
  .login-form { gap: 14px; }
}
@media (max-height: 640px) {
  .vc-obs, .vitrine-meio p { display: none; }
  .vitrine-meio h2 { margin-bottom: 18px; }
  .login-titulo { font-size: 26px; }
  .login-marca { margin-bottom: 20px; }
}
@media (max-height: 540px) {
  .vitrine-recursos { display: none; }
}

/* Celular/tablet: a vitrine escura vira um cabeçalho compacto e o formulário sobe por cima como um cartão branco. */
@media (max-width: 980px) {
  html:has(#tela-login:not([hidden])), html:has(#tela-login:not([hidden])) body { background: #0d0e10; overflow: auto; }
  .login {
    grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible;
    background:
      radial-gradient(420px 300px at 100% 0%, rgba(239, 223, 0, .2), transparent 65%),
      linear-gradient(170deg, #1c1d21 0%, #0d0e10 60%);
  }
  .login-vitrine { padding: 18px 22px 22px; gap: 0; background: transparent; justify-content: flex-start; }
  .login-vitrine::before { width: 280px; height: 280px; right: -120px; top: -110px; }
  .login-vitrine::after { width: 170px; height: 170px; right: -40px; top: -30px; }
  .vitrine-logo { height: 28px; }
  .vitrine-logo-best { height: 24px; }
  .vitrine-divisor { height: 22px; }
  .vitrine-topo { gap: 14px; }
  .vitrine-meio { margin-top: 16px; }
  .vitrine-selo { font-size: 10px; padding: 3px 9px; }
  .vitrine-meio h2 { font-size: 21px; margin: 10px 0 0; max-width: 320px; }
  .vitrine-meio p, .vitrine-card, .vitrine-recursos { display: none; }

  .login-painel {
    background: #fff; border-radius: 26px 26px 0 0; padding: 30px 22px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -18px 40px rgba(0, 0, 0, .35); justify-content: flex-start; position: relative;
  }
  /* Alcinha amarela no topo do cartão, como uma "gaveta" */
  .login-painel::before { content: ''; position: absolute; top: 10px; left: 50%; width: 42px; height: 4px; margin-left: -21px; border-radius: 99px; background: var(--amarelo); }
  /* margin auto (vertical e horizontal): o formulário fica no meio do cartão branco */
  .login-caixa { margin: auto; }
  .login-marca { display: none; }
  .login-titulo { font-size: 26px; }
  .login-sub { margin: 4px 0 22px; }
  .login-rodape { margin-top: 0; padding-top: 24px; }
}
/* Tablet com tela alta: cabe o texto de apresentação no cabeçalho escuro. */
@media (min-width: 600px) and (max-width: 980px) and (min-height: 760px) {
  .login-vitrine { padding-bottom: 40px; }
  .vitrine-meio p { display: block; font-size: 14px; line-height: 1.55; margin: 12px 0 0; max-width: 420px; }
}
/* Tablet em pé: cartão do formulário centralizado e mais estreito. */
@media (min-width: 600px) and (max-width: 980px) {
  .login-vitrine { padding: 40px 48px 36px; align-items: center; text-align: center; }
  .vitrine-topo { justify-content: center; }
  .vitrine-meio p { margin-left: auto; margin-right: auto; }
  .vitrine-meio h2 { font-size: 32px; max-width: 460px; margin-left: auto; margin-right: auto; }
  .login-painel { width: min(520px, calc(100% - 48px)); margin: 0 auto; border-radius: 26px 26px 0 0; padding-top: 40px; }
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: 248px; flex: none; background: var(--sidebar); padding: 22px 14px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.menu { display: grid; gap: 4px; }
.menu-secao { color: #5e636d; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.menu a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--sidebar-texto); text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.menu a:hover { background: var(--sidebar-hover); color: #fff; }
.menu a.ativo { background: var(--amarelo); color: var(--preto); }
.menu a .badge { margin-left: auto; background: #2a2c31; color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 99px; }
.menu a.ativo .badge { background: var(--preto); }
.menu svg { width: 19px; height: 19px; flex: none; }

.usuario-box {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px;
  background: var(--sidebar-hover); border-radius: 12px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--amarelo); color: var(--preto);
  display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none;
}
.usuario-info { min-width: 0; flex: 1; }
.usuario-info strong { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-info small { color: var(--sidebar-texto); font-size: 11.5px; }
.usuario-box .icone-btn { color: var(--sidebar-texto); }
.usuario-box .icone-btn:hover { color: #fff; background: #2a2c31; }

.conteudo { flex: 1; min-width: 0; padding: 26px 32px 48px; }
.topo { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.topo h1 { font-size: 24px; }
.topo-acoes { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.btn-sair-mobile { display: none; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--borda-forte); background: var(--superficie); padding: 9px 16px;
  border-radius: 10px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #b9bdc5; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primario { background: var(--amarelo); border-color: var(--amarelo); color: var(--preto); font-weight: 600; }
.btn-primario:hover { background: #f7e81a; border-color: var(--amarelo-escuro); }
.btn-escuro { background: var(--preto); border-color: var(--preto); color: #fff; }
.btn-escuro:hover { background: #2a2c31; border-color: #2a2c31; }
.btn-perigo { color: var(--perigo); }
.btn-perigo:hover { border-color: var(--perigo); background: #fff5f5; }
.btn-bloco { width: 100%; padding: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icone-btn {
  width: 34px; height: 34px; border: 0; background: transparent; border-radius: 9px;
  display: grid; place-items: center; cursor: pointer; color: var(--texto-2); flex: none;
}
.icone-btn:hover { background: #eceef1; color: var(--texto); }
.icone-btn svg { width: 18px; height: 18px; }

/* ---------- Formulários ---------- */
label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--texto-2); }
input, select, textarea {
  width: 100%; border: 1px solid var(--borda-forte); background: #fff; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
/* Seta própria nos selects, afastada da borda (a nativa fica colada no canto). */
select:not(.status-select) {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366707f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
}
input:focus, select:focus, textarea:focus { border-color: var(--preto); box-shadow: 0 0 0 3px rgba(239, 223, 0, .45); }
input:disabled, select:disabled, textarea:disabled { background-color: #f6f7f9; color: var(--texto-2); }
.obrigatorio::after { content: ' *'; color: var(--perigo); }
.erro { color: var(--perigo); font-size: 13px; margin: 0; background: #fff3f3; border: 1px solid #f6d2d2; padding: 8px 12px; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
/* Status ganha mais espaço que a data, para "Encaminhado ao Vendedor" caber inteiro. */
.linha-status { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.campo-auto { background: #f6f7f9; border: 1px dashed var(--borda-forte); border-radius: 10px; padding: 10px 12px; color: var(--texto-2); font-size: 14px; }

/* ---------- Cartões ---------- */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); }
.card-cab { display: flex; align-items: center; gap: 10px; padding: 18px 20px 4px; }
.card-cab h2 { font-size: 15px; }
.card-cab .muted { font-size: 12px; margin-left: auto; }
.card-corpo { padding: 16px 20px 20px; }

/* ---------- Dashboard ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filtros select, .filtros input { width: auto; min-width: 150px; padding: 8px 12px; }
.filtros select { padding-right: 38px; }
.filtros .busca { flex: 1; min-width: 220px; }
/* Datas no mesmo estilo da barra de período; ficam "acesas" quando o período é personalizado. */
.filtros .datas { align-items: center; flex-wrap: nowrap; }
.filtros .datas span { font-size: 13px; color: var(--texto-2); padding: 0 2px; }
.filtros .datas input { min-width: 0; width: auto; border: 0; background: transparent; padding: 5px 8px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--texto-2); cursor: pointer; }
.filtros .datas input:focus { box-shadow: none; background: rgba(255, 255, 255, .6); }
.filtros .datas.ativo input { background: #fff; color: var(--texto); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.segmentado { display: inline-flex; background: #e9ebef; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmentado button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--texto-2); }
.segmentado button.ativo { background: #fff; color: var(--texto); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; }
.kpi span { font-size: 12.5px; color: var(--texto-2); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi strong { display: block; font-size: 30px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.destaque { background: var(--preto); border-color: var(--preto); }
.kpi.destaque span, .kpi.destaque small { color: #b8bcc4; }
.kpi.destaque strong { color: var(--amarelo); }
.kpi.positivo { background: var(--st-encaminhado-bg); border-color: #bfe5cd; }
.kpi.positivo strong { color: var(--st-encaminhado); }
.ponto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.grade-dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; }

/* Barras horizontais */
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 44px; align-items: center; gap: 12px; font-size: 13px; cursor: default; }
.hbar-rotulo { color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-trilho { display: block; height: 10px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--barra); border-radius: 0 4px 4px 0; transition: width .4s ease, background .15s; }
.hbar:hover .hbar-fill { background: var(--barra-hover); }
.hbar:hover .hbar-rotulo { color: var(--texto); }
.hbar-valor { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.vazio { color: var(--muted); text-align: center; padding: 28px 10px; font-size: 13px; }

/* Colunas por dia */
.colunas { display: flex; align-items: flex-end; gap: 2px; height: 180px; padding-top: 8px; border-bottom: 1px solid var(--borda); }
.coluna { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; min-width: 4px; }
.coluna i { display: block; width: 100%; background: var(--barra); border-radius: 4px 4px 0 0; min-height: 0; transition: background .15s; }
.coluna:hover i { background: var(--amarelo-escuro); }
.colunas-eixo { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--preto); color: #fff;
  padding: 7px 11px; border-radius: 8px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
.tooltip b { color: var(--amarelo); font-weight: 600; }

/* ---------- Tabela de leads ---------- */
/* A tabela nunca rola para os lados: o texto quebra linha e, em telas menores, vira cartões. */
table { width: 100%; border-collapse: collapse; }
/* Larguras fixas: as colunas não mudam de lugar conforme os leads filtrados.
   Status, Entrada e SDR têm largura própria; as demais dividem o restante por igual. */
.tabela-leads { table-layout: fixed; }
.tabela-leads .c-status { width: 236px; }
.tabela-leads .c-entrada { width: 104px; }
.tabela-leads .c-sdr { width: 84px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 600; padding: 12px 10px; border-bottom: 1px solid var(--borda); background: #fafbfc;
}
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
td { padding: 12px 10px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; overflow-wrap: break-word; }
td .tag { white-space: nowrap; }
/* Etiqueta do veículo sempre na linha de baixo do interesse. */
td.interesse .tag { display: table; margin-top: 4px; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #fbfaf0; }
td.cliente strong, td.duplo strong { display: block; font-weight: 600; }
td.duplo strong { font-weight: 500; }
td.cliente small, td.duplo small { color: var(--muted); white-space: nowrap; }
td:nth-child(2) { white-space: nowrap; }
td.obs { color: var(--texto-2); font-size: 13px; min-width: 120px; }
td.obs span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rodape-tabela { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: var(--muted); font-size: 13px; gap: 10px; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-primeiro { background: var(--st-primeiro-bg); color: var(--st-primeiro); }
.st-tratativa { background: var(--st-tratativa-bg); color: var(--st-tratativa); }
.st-encaminhado { background: var(--st-encaminhado-bg); color: var(--st-encaminhado); }
.st-finalizado { background: var(--st-finalizado-bg); color: var(--st-finalizado); }
select.status-select {
  width: auto; max-width: 100%; border: 0; padding: 5px 30px 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none; background-repeat: no-repeat; background-position: right 12px center; background-size: 11px;
}
/* Seta da cor de cada status, um pouco afastada da borda da pílula. */
select.status-select.st-primeiro { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232856c7' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select.status-select.st-tratativa { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a6200' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select.status-select.st-encaminhado { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b7a48' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select.status-select.st-finalizado { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6570' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; background: #f0f1f4; color: var(--texto-2); font-size: 12px; font-weight: 500; }
.tag-sdr { background: #fdf9cc; color: #6b6300; }

/* ---------- Ficha do lead ---------- */
.ficha { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ficha-cab { display: flex; align-items: center; gap: 14px; padding: 20px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.ficha-cab .avatar { width: 48px; height: 48px; font-size: 17px; }
.ficha-cab h2 { font-size: 18px; }
.ficha-acoes { width: 100%; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.ficha-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.acoes-form { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.acoes-form .btn-perigo { margin-right: auto; }


.timeline-novo { padding: 16px 20px; border-bottom: 1px solid var(--borda); display: grid; gap: 10px; }
.timeline-novo textarea { min-height: 76px; }
.timeline-novo .btn { justify-self: end; }
.timeline { list-style: none; margin: 0; padding: 18px 20px 8px; position: relative; max-height: 640px; overflow-y: auto; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--borda); }
.timeline li:last-child::before { display: none; }
.timeline .marcador { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--amarelo); border: 3px solid var(--preto); }
.timeline li.sistema .marcador { background: #fff; border-color: var(--borda-forte); }
.timeline .tl-cab { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
.timeline .tl-cab strong { color: var(--texto); font-weight: 600; font-size: 13px; }
.timeline .tl-cab .icone-btn { width: 26px; height: 26px; margin-left: auto; }
.timeline .tl-cab .icone-btn svg { width: 15px; height: 15px; }
.timeline .tl-texto { margin-top: 4px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.timeline li.nota .tl-texto { background: #f7f8fa; border: 1px solid var(--borda); padding: 10px 12px; border-radius: 10px; }
.timeline li.sistema .tl-texto { color: var(--texto-2); font-size: 13px; }

/* ---------- Vendedores ---------- */
/* Cidades em colunas (como os Scripts), cada uma com os vendedores um embaixo do outro. */
.grade-cidades { columns: 2 420px; column-gap: 14px; }
.cidade-vend { margin-bottom: 14px; break-inside: avoid; }

/* ---------- Scripts ---------- */
/* Colunas (e não grade) para cada cartão ter só a própria altura, sem buracos entre eles. */
.grade-scripts { columns: 2 420px; column-gap: 14px; }
.grade-scripts .script { break-inside: avoid; margin-bottom: 14px; }
.script .card-cab { padding-bottom: 12px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.script-copiar { margin-left: auto; padding: 7px 14px; }
.tag-atalho { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.script-texto { white-space: pre-wrap; font-size: 14px; line-height: 1.6; background: #f6f7f9; border-radius: 10px; padding: 14px 16px; }
.cidade-cab { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--borda); }
.cidade-cab h2 { font-size: 16px; }
.cidade-cab .muted { font-size: 12.5px; }
.cidade-total { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.cidade-total strong { color: var(--texto); font-size: 15px; font-weight: 600; margin-right: 2px; }
.lista-vend { list-style: none; margin: 0; padding: 12px; display: grid; gap: 8px; }
.lista-vend li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid #eef0f3; border-radius: 10px; background: #fcfcfd; }
.lista-vend .avatar { width: 34px; height: 34px; font-size: 12px; background: #eef0f3; color: var(--texto); }
.lista-vend .info { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.lista-vend .nome { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.lista-vend .tags { display: flex; gap: 4px; }
.lista-vend .tag { font-size: 11px; padding: 2px 7px; }
.lista-vend .num { display: grid; justify-items: end; line-height: 1.2; white-space: nowrap; flex: none; }
.lista-vend .num strong { font-size: 16px; font-weight: 600; }
.lista-vend .num small { color: var(--muted); font-size: 11px; }

/* ---------- Diversos ---------- */
.aviso-leitura { display: inline-flex; align-items: center; gap: 8px; background: #fdf9cc; color: #6b6300; padding: 7px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 500; }
.aviso-leitura svg { width: 15px; height: 15px; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--preto); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13.5px; border-left: 4px solid var(--amarelo); animation: entra .2s ease; max-width: 360px; }
.toast.erro-t { border-left-color: var(--perigo); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(420px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 11, 13, .55); }
.modal-corpo { padding: 24px; display: grid; gap: 14px; }
.modal-corpo h2 { font-size: 18px; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.carregando { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- Responsivo ---------- */
/* Só existem no celular/tablet. */
.nav-inferior, .btn-filtros { display: none; }
.btn-filtros .contador { background: var(--preto); color: var(--amarelo); border-radius: 99px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; }

/* Tabela de leads vira cartões. Posições fixas: cliente e data no topo, status, depois as informações em 2 colunas. */
@media (max-width: 1180px) {
  thead, colgroup { display: none; }
  table, tbody { display: block; }
  tbody tr {
    display: grid; gap: 10px 16px; padding: 14px 16px; border-bottom: 1px solid var(--borda);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "cliente cliente cliente entrada"
      "status status cidade interesse"
      "vendedor sdr obs obs";
  }
  tbody tr.linha-vazia { display: block; }
  td, td:first-child, td:last-child { padding: 0; border: 0; white-space: normal; min-width: 0; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
  td.cliente { grid-area: cliente; }
  td.cliente::before, td[data-label="Status"]::before, td[data-label="Entrada"]::before { display: none !important; }
  td.cliente strong { font-size: 15px; }
  td[data-label="Status"] { grid-area: status; align-self: center; }
  td[data-label="Entrada"] { grid-area: entrada; text-align: right; color: var(--muted); font-size: 12.5px; }
  td[data-label="SDR"] { grid-area: sdr; }
  td[data-label="Cidade / Origem"] { grid-area: cidade; }
  td[data-label="Interesse"] { grid-area: interesse; }
  td[data-label="Vendedor"] { grid-area: vendedor; }
  td.obs { grid-area: obs; min-width: 0; }
}
@media (max-width: 1100px) {
  .col-8, .col-6, .col-4 { grid-column: span 12; }
  .ficha { grid-template-columns: 1fr; }
}

/* Celular e tablet: some o menu lateral; navegação na barra inferior e "Sair" no canto do topo. */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .btn-sair-mobile {
    display: inline-flex; align-items: center; gap: 8px; flex: none; align-self: flex-start;
    border: 1px solid var(--borda); background: #fff; border-radius: 99px; padding: 4px 12px 4px 4px;
    font: inherit; font-size: 13px; color: var(--texto-2); cursor: pointer;
  }
  .btn-sair-mobile .avatar { width: 30px; height: 30px; font-size: 11.5px; }
  .btn-sair-mobile svg { width: 16px; height: 16px; }
  .btn-sair-mobile b { font-weight: 600; }
  .btn-sair-mobile:active { background: #f4f5f7; }
  .conteudo { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .topo { flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
  .topo > div:not(.topo-acoes) { flex: 1; min-width: 0; }
  .topo h1 { font-size: 21px; }
  .topo-acoes { width: 100%; margin-left: 0; }
  .topo-acoes .btn { flex: 1; }

  .nav-inferior {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--sidebar); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .18);
  }
  .nav-inferior a {
    flex: 1; min-width: 0; display: grid; justify-items: center; gap: 3px; padding: 7px 2px; border-radius: 10px;
    color: var(--sidebar-texto); text-decoration: none; font-size: 11px; font-weight: 500;
  }
  .nav-inferior a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-inferior svg { width: 21px; height: 21px; }
  .nav-inferior a.ativo { background: var(--amarelo); color: var(--preto); font-weight: 600; }
  .toasts { left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .linha-status { grid-template-columns: 1fr; }
  .acoes-form .btn { flex: 1; }
  .filtros select, .filtros input { flex: 1; min-width: 140px; }

  /* Leads: só a busca à vista; os demais filtros abrem no botão "Filtros". */
  .filtros-leads .btn-filtros { display: inline-flex; flex: none; }
  .filtros-leads > select, .filtros-leads > #btn-limpar { display: none; }
  .filtros-leads.aberto > select, .filtros-leads.aberto > #btn-limpar { display: block; flex: 1 1 calc(50% - 5px); min-width: 0; font-size: 13.5px; }
  .filtros-leads.aberto > #btn-limpar { display: inline-flex; }
  /* Busca + botão sempre sozinhos na 1ª linha; os filtros abertos vêm embaixo, 2 por linha. */
  .filtros-leads .busca { flex: 1 1 60%; min-width: 0; }

  /* Números do dashboard: total na largura toda e os demais em 2x2. */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi.destaque { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .kpi.destaque strong { grid-row: span 2; margin: 0; }

  /* Dashboard: períodos numa linha que rola para o lado; datas e SDRs ocupam a largura. */
  .filtros-dash, .filtros-linha { width: 100%; }
  .filtros-dash .segmentado { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .filtros-dash .segmentado::-webkit-scrollbar { display: none; }
  .filtros-dash .segmentado button { white-space: nowrap; flex: none; }
  .filtros-dash .datas { width: 100%; justify-content: space-between; }
  .filtros-dash .datas input { flex: 1; }
  .filtros-dash #seg-sdr { width: 100%; }
  .filtros-dash #seg-sdr button { flex: 1; }

}

/* Celular: tudo mais compacto. */
@media (max-width: 600px) {
  #subtitulo-pagina, .aviso-leitura { display: none; }
  .topo h1 { font-size: 20px; }

  .kpi { padding: 14px; }
  .kpi strong { font-size: 26px; margin-top: 4px; }
  .kpi span { font-size: 12px; }
  .kpi small { font-size: 11px; }
  .grade-dash { gap: 12px; }
  .card-cab { padding: 16px 16px 2px; }
  .card-corpo { padding: 14px 16px 16px; }
  .hbar { grid-template-columns: minmax(80px, 110px) 1fr 32px; gap: 10px; }

  /* Cartão de lead em 2 colunas. */
  tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px;
    grid-template-areas:
      "cliente entrada"
      "status status"
      "cidade interesse"
      "vendedor sdr"
      "obs obs";
  }
  .rodape-tabela { justify-content: center; text-align: center; }

  .ficha-cab { padding: 16px; }
  .ficha-acoes .btn { flex: 1; }
  .timeline-novo { padding: 14px 16px; }
  .timeline-novo .btn { justify-self: stretch; }
  .timeline { padding: 16px 16px 6px; max-height: none; }

  .grade-cidades, .grade-scripts { columns: 1; }
  .cidade-cab { padding: 14px 16px 10px; }
  .lista-vend { padding: 10px; }
  .lista-vend li { padding: 10px 12px; gap: 10px; }
  .lista-vend .avatar { display: none; }
  .lista-vend .nome { white-space: normal; }
  .lista-vend .tags { flex-wrap: wrap; }
  .script .card-cab { flex-wrap: nowrap; }
  .script .card-cab h2 { flex: 1; min-width: 0; font-size: 14px; }
  .script-copiar { padding: 8px 10px; }
  .script-copiar span { display: none; }
}
option[class^='st-'] { font-weight: 600; }
.wpp-citacao { display: inline-block; border-left: 3px solid var(--borda-forte); padding-left: 10px; color: var(--texto-2); }
/* Dashboard: período + datas em cima, SDRs sempre na linha de baixo. */
.filtros-dash { flex-direction: column; align-items: flex-start; }
.filtros-linha { display: flex; flex-wrap: wrap; gap: 10px; }
/* Sugestões de observação no cadastro de lead. */
.campo-obs { display: grid; gap: 8px; }
.sugestoes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sugestao { border: 1px dashed var(--borda-forte); background: #fff; border-radius: 99px; padding: 4px 12px; font-size: 12.5px; color: var(--texto-2); cursor: pointer; }
.sugestao:hover { border-color: var(--preto); color: var(--texto); background: #fffbe0; }

/* Celular/tablet: campos com 16px — abaixo disso o iPhone amplia a página ao tocar no campo. */
@media (max-width: 860px) {
  input, select, textarea,
  .login-form input,
  .filtros select, .filtros input,
  .filtros-leads.aberto > select,
  .filtros .datas input { font-size: 16px; }
}
