/* Paleta reaproveitada do relatorio comercial que a area de vendas ja usava
   (copa_tupi_oportunidades_*.html) — mantem o site com a mesma cara em
   todas as telas: creme/verde, cartoes arredondados, pilulas coloridas. */
:root {
  --bg: #f4f1e8;
  --ink: #18251f;
  --muted: #657169;
  --panel: #fffefa;
  --line: #ded5c5;
  --blue2: #3b9fd6;
  --blue2-tint: #dbeffc;
  --amber: #f59e0b;
  --red: #c73939;
  --blue: #186da3;
  --purple: #6d5bd0;
  --gold: #b8860b;
  --silver: #8a8f98;
  --bronze: #a35a2a;
  --navbg: #0a1a3a;
  --shadow: 0 28px 80px rgba(54, 43, 27, .14);
  /* cores oficiais da campanha (mesmas do copa-tupi-regras.html) */
  --liga-lfr: #7cb518;
  --liga-lfr-fill: linear-gradient(90deg, #8bc926, #c3f562);
  --liga-cat: #1f7cc9;
  --liga-cat-fill: linear-gradient(90deg, #1f7cc9, #6fc0ff);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, #f7f0df, #edf5ea 55%, #e9f2ff);
  color: var(--ink);
}

/* ---------- navegacao ---------- */
nav {
  background: var(--navbg);
  padding: 14px 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
nav .logo { justify-self: center; }
nav .logo img { height: 42px; display: block; }
nav .links a {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  margin-right: 22px;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
nav .links a:hover { border-color: var(--blue2-tint); }
nav .user { display: flex; align-items: center; gap: 14px; color: #fff; font-size: 14px; justify-self: end; }
nav form { display: inline; }
nav .user .link-senha,
nav button {
  background: #fff;
  border: none;
  color: var(--navbg);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
}
nav .user .link-senha:hover,
nav button:hover {
  background: var(--blue2-tint);
}

/* ---------- botao flutuante do bot (Telegram, a ligar depois) ---------- */
.bot-flutuante {
  position: fixed; right: 24px; bottom: 24px; z-index: 500;
  display: flex; align-items: center; gap: 9px;
  background: var(--blue2); color: #fff; border: none;
  padding: 14px 20px; border-radius: 999px; font-weight: 800; font-size: 14px;
  font-family: inherit; cursor: pointer; text-decoration: none;
  box-shadow: 0 14px 30px rgba(24, 60, 90, .3);
  transition: padding .25s ease, gap .25s ease, background .15s ease;
}
.bot-flutuante:hover { background: var(--blue); }
.bot-flutuante svg { width: 20px; height: 20px; flex-shrink: 0; }
.bot-flutuante .bot-texto {
  max-width: 220px; overflow: hidden; white-space: nowrap; opacity: 1;
  transition: max-width .25s ease, opacity .2s ease;
}
.bot-flutuante.recolhido { padding: 14px; gap: 0; }
.bot-flutuante.recolhido .bot-texto { max-width: 0; opacity: 0; }
@media (max-width: 640px) {
  .bot-flutuante .bot-texto { display: none; }
  .bot-flutuante { padding: 14px; }
}

.page { max-width: 1100px; margin: 0 auto; padding: 26px 16px 40px; }
h1 { font-size: 1.6rem; margin: 0 0 18px; letter-spacing: -.02em; }

/* ---------- componentes genericos (cartao, pilulas, tabela) ---------- */
.card {
  background: rgba(255, 254, 250, .94);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid;
}
.contra { background: #fff2d9; color: #9a530b; border-color: #e8bc78; }
.risk { background: #ffe6e6; color: var(--red); border-color: #eaa3a3; }
.ok { background: #e6f5ff; color: #155f88; border-color: #9ecce7; }
.opp { background: #e7f3fb; color: #1f6f95; border-color: #a9d7ef; }
.new { background: #eeeaff; color: var(--purple); border-color: #c8c0ff; }
.badge-liga-lfr { background: #eef8db; color: var(--liga-lfr); border-color: #bfe28a; }
.badge-liga-cat { background: #e2f0fb; color: var(--liga-cat); border-color: #a7d0f0; }

table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 0 10px; }
td { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 10px; font-size: 13px; vertical-align: top; }
td:first-child { border-left: 1px solid var(--line); border-radius: 14px 0 0 14px; }
td:last-child { border-right: 1px solid var(--line); border-radius: 0 14px 14px 0; }
tr.reactivate td { background: #fff0f0; border-color: #efb0b0; }
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); background: #fff; }
.note { font-size: 12px; color: var(--muted); line-height: 1.45; }
a.link { color: var(--blue); text-decoration: none; font-weight: 700; }
.voltar { display: inline-block; margin-bottom: 16px; }

/* ---------- login ---------- */
.login-shell { display: flex; min-height: calc(100vh - 0px); align-items: center; justify-content: center; padding: 24px; }
.login-shell.compacto { min-height: auto; padding: 40px 24px; }
.login-box { max-width: 380px; width: 100%; }
.login-box h1 { text-align: center; }
.login-titulo-logo { display: block; margin: 4px auto 12px; max-height: 150px; width: auto; max-width: 100%; }
.login-box .sub { text-align: center; color: var(--muted); margin: -8px 0 20px; }
.login-logo {
  background: var(--navbg);
  margin: -20px -20px 24px -20px;
  padding: 30px 20px;
  border-radius: 28px 28px 0 0;
  display: flex;
  justify-content: center;
}
.login-logo img { height: 72px; display: block; }
.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%; padding: 13px 14px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 14px;
}
.login-box input:focus { outline: 2px solid var(--blue2); }
.login-box button {
  width: 100%; padding: 13px; background: var(--navbg); color: #fff; border: none;
  border-radius: 999px; cursor: pointer; font-weight: 800; font-size: 15px;
}
.login-box button:hover { background: var(--blue); }
.chk-senha {
  display: flex; align-items: center; gap: 8px;
  margin: -6px 0 14px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
}
.chk-senha input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; accent-color: var(--navbg); cursor: pointer;
}
.erro {
  background: #ffe6e6; color: var(--red); border: 1px solid #eaa3a3;
  border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}
.sucesso {
  background: var(--blue2-tint); color: var(--blue2); border: 1px solid #a9d7ef;
  border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; font-weight: 700;
}

/* ---------- lista de vendedores (admin) ---------- */
.vendedores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.vendedor-card {
  display: block; text-decoration: none; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.vendedor-card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px rgba(54, 43, 27, .18); }
.vendedor-card .nome { font-size: 17px; font-weight: 800; margin: 10px 0 4px; }
.vendedor-card .meta { color: var(--muted); font-size: 13px; }
.vendedor-card .stats { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- ranking ---------- */
.rank-pos { font-weight: 900; font-size: 16px; width: 40px; }
.rank-1 .rank-pos { color: var(--gold); }
.rank-2 .rank-pos { color: var(--silver); }
.rank-3 .rank-pos { color: var(--bronze); }
.rank-pontos { font-weight: 800; color: var(--blue2); }
.rank-pontos--lfr { color: var(--liga-lfr); }
.rank-pontos--cat { color: var(--liga-cat); }

.btn-regras {
  display: inline-block; margin: -8px 0 22px; text-decoration: none;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 13px;
  padding: 10px 18px; border-radius: 999px;
}
.btn-regras:hover { background: var(--liga-cat); }

.liga-card--lfr { border-left: 5px solid var(--liga-lfr); }
.liga-card--cat { border-left: 5px solid var(--liga-cat); }

.aviso-teste {
  background: #fff6da; border: 1px solid #e9d28a; color: #6b5518;
  font-size: 13px; font-weight: 700; padding: 10px 16px; border-radius: 14px;
  margin: -6px 0 18px; max-width: 720px;
}

.ranking-topo { display: flex; align-items: center; gap: 12px; margin: -8px 0 22px; flex-wrap: wrap; }
.ranking-topo .btn-regras { margin: 0; }
.btn-replay { background: var(--liga-lfr); border: none; cursor: pointer; font-family: inherit; }
.btn-replay:hover { background: var(--liga-cat); }
.btn-replay:disabled { opacity: .7; cursor: default; }

.tabela-ranking tr[data-rep-id] { will-change: transform; }
.rank-nome { font-weight: 700; }

.podios-row { display: flex; gap: 22px; margin: 0 0 20px; flex-wrap: wrap; }
.podio-bloco { flex: 1 1 260px; min-width: 220px; }
.podio-titulo { margin: 0 0 10px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.podio {
  display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 10px;
  margin: 0; max-width: 360px;
}
.podio-item {
  background: var(--paper2, #f6f1e4); border-radius: 16px 16px 8px 8px; text-align: center;
  padding: 14px 8px 10px; display: flex; flex-direction: column; justify-content: center;
  min-height: 96px;
}
.podio-1 { order: 2; min-height: 128px; box-shadow: 0 10px 24px rgba(0,0,0,.08); }
.podio-2 { order: 1; }
.podio-medalha { font-size: 26px; }
.podio-nome {
  font-weight: 800; font-size: 13px; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.podio-pontos { font-weight: 700; font-size: 12px; color: var(--muted); margin-top: 2px; }

.podio-card-geral {
  text-align: center; background: linear-gradient(180deg, #fff9e8, var(--paper, #fffefa));
  border: 1px solid #e9d28a;
}
.podio-card-geral .podio-titulo { text-align: center; font-size: 15px; }

.campeao-solo { display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; }
.campeao-solo-medalha { font-size: 44px; line-height: 1; }
.campeao-solo-nome { font-weight: 900; font-size: 18px; margin-top: 8px; }
.campeao-solo-pontos { font-weight: 700; font-size: 14px; color: var(--muted); margin-top: 2px; }

/* ---------- dashboard do representante (fiel ao relatorio comercial) ---------- */
.dash-header { max-width: 1800px; margin: auto; padding: 30px 14px 16px; }
.dash-header h1 { margin: 0; font-size: clamp(28px, 4vw, 52px); letter-spacing: -.06em; line-height: .93; }
.dash-header .sub { color: var(--muted); line-height: 1.5; max-width: 980px; }
.shell { max-width: 1800px; margin: auto; padding: 0 14px 36px; display: grid; grid-template-columns: 320px 1fr; gap: 14px; }
aside { position: sticky; top: 14px; align-self: start; background: rgba(255, 254, 250, .92); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.aside-top { padding: 18px; border-bottom: 1px solid var(--line); }
input, select, textarea { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; color: var(--ink); outline: none; font-size: 14px; font-family: inherit; }
textarea { display: block; width: 100%; resize: vertical; margin-bottom: 12px; }
.search { width: 100%; }
.client-list { padding: 10px; max-height: 70vh; overflow: auto; }
.client-btn { display: block; width: 100%; border: 1px solid transparent; background: transparent; border-radius: 18px; text-align: left; padding: 14px; margin-bottom: 8px; cursor: pointer; font-family: inherit; }
.client-btn.active, .client-btn:hover { background: var(--blue2-tint); border-color: #a9d7ef; }
.client-btn b { display: block; font-size: 13px; }
.alerta-ponto {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  background: var(--red); margin-right: 6px; vertical-align: middle;
}
.client-btn span { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.35; }
.dash-main { display: grid; gap: 18px; }
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.hero.hero-solo { grid-template-columns: 1fr; max-width: 700px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.kpis-2 { grid-template-columns: repeat(2, 1fr); }
.potencial-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.potencial-item strong { font-size: 20px; }
.potencial-label { display: block; color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
.kpi { background: #f5f0e8; border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; color: var(--blue2); font-size: 24px; margin-top: 6px; white-space: nowrap; }
.btn-oportunidades {
  margin-top: 10px; background: var(--blue2); color: #fff; border: none; border-radius: 999px;
  padding: 7px 14px; font-size: 12px; font-weight: 800; cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.btn-oportunidades:hover { background: var(--blue); }
.oportunidades-box {
  margin-top: 14px; padding: 15px; background: #f7f3ea; border: 1px solid var(--line);
  border-radius: 20px; max-height: 500px; overflow-y: auto;
}
.oportunidades-box table { table-layout: fixed; }
.oportunidades-box th, .oportunidades-box td {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.oportunidades-box th:nth-child(2), .oportunidades-box td:nth-child(2) {
  white-space: normal;
}
.oportunidades-box table.tabela-produtos th:nth-child(1), .oportunidades-box table.tabela-produtos td:nth-child(1) { width: 14%; }
.oportunidades-box table.tabela-produtos th:nth-child(2), .oportunidades-box table.tabela-produtos td:nth-child(2) { width: 22%; }
.oportunidades-box table.tabela-produtos th:nth-child(3), .oportunidades-box table.tabela-produtos td:nth-child(3) { width: 22%; }
.oportunidades-box table.tabela-produtos th:nth-child(4), .oportunidades-box table.tabela-produtos td:nth-child(4) { width: 12%; }
.oportunidades-box table.tabela-produtos th:nth-child(5), .oportunidades-box table.tabela-produtos td:nth-child(5) { width: 12%; }
.oportunidades-box table.tabela-produtos th:nth-child(6), .oportunidades-box table.tabela-produtos td:nth-child(6) { width: 18%; }
.oportunidades-box table.tabela-oportunidades th:nth-child(1), .oportunidades-box table.tabela-oportunidades td:nth-child(1) { width: 18%; }
.oportunidades-box table.tabela-oportunidades th:nth-child(2), .oportunidades-box table.tabela-oportunidades td:nth-child(2) { width: 52%; }
.oportunidades-box table.tabela-oportunidades th:nth-child(3), .oportunidades-box table.tabela-oportunidades td:nth-child(3) { width: 30%; }
.coverage-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.coverage-card { background: #f7f3ea; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.coverage-card-header {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: none; cursor: pointer; padding: 15px; font-family: inherit; text-align: left;
}
.coverage-card-header:hover { background: rgba(0, 0, 0, .03); }
.coverage-card-title { display: flex; flex-direction: column; gap: 3px; }
.coverage-toggle { font-size: 18px; font-weight: 800; color: var(--muted); line-height: 1; }
.coverage-card-body { padding: 0 15px 15px; }
.coverage-clientes-wrap { max-height: 260px; overflow: auto; margin-bottom: 10px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 9px; font-size: 12px; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 1fr; padding: 0 14px 24px; }
  aside { position: static; }
  .dash-header { padding: 22px 14px 12px; }
  .hero, .coverage-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
}

/* ---------- popup de primeiro acesso ---------- */
.overlay-primeiro-acesso {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(24, 37, 31, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.popup-primeiro-acesso {
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow); padding: 28px; max-width: 440px; width: 100%;
}
.popup-primeiro-acesso h3 { margin: 0 0 10px; font-size: 20px; }
.popup-primeiro-acesso p { margin: 0 0 8px; color: var(--ink); font-size: 14px; line-height: 1.5; }
.popup-passos { background: #f7f3ea; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 14px 0; }
.popup-passos p { margin-bottom: 6px; }
.popup-passos ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.popup-botoes { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.popup-botoes .btn-regras { margin: 0; }
.popup-fechar {
  display: inline-block; background: var(--red); border: none; color: #fff; font-weight: 800;
  font-size: 13px; cursor: pointer; padding: 10px 18px; border-radius: 999px; font-family: inherit;
}
.popup-fechar:hover { background: #a82e2e; }
