/* ============================================================
   INDICE CONTRA — Tema Slate / Esmeralda (v1.1)
   ============================================================ */

:root {
  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-500: #64748B;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50: #F8FAFC;
  --teal-700: #0F766E;
  --teal-600: #0D9488;
  --teal-500: #14B8A6;
  --amber-500: #F59E0B;
  --blue-500: #3B82F6;
  --emerald-500: #10B981;
  --red-500: #EF4444;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .06);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--slate-100);
  color: var(--slate-900);
  font-size: 14px;
}

body.bloqueado { overflow: hidden; }

button { font-family: inherit; }

/* ============================================================
   TELA DE LOGIN
   ============================================================ */

.login-fundo {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(20, 184, 166, .35), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(59, 130, 246, .22), transparent 60%),
    linear-gradient(160deg, #0F172A 0%, #1E293B 55%, #0F172A 100%);
}

.login-fundo.oculto { display: none; }

.login-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 380px;
  padding: 34px 32px 26px;
  animation: subir .3s ease-out;
}

.login-marca {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-monograma {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(13, 148, 136, .35);
}

.login-marca h1 {
  margin: 0;
  font-size: 21px;
  color: var(--slate-900);
  letter-spacing: .3px;
}

.login-sub {
  margin: 0 0 22px;
  color: var(--slate-500);
  font-size: 12.5px;
}

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-form .campo { gap: 5px; }

.login-boas-vindas {
  margin: 0;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: var(--teal-700);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.btn-bloco { width: 100%; justify-content: center; padding: 11px; }

.form-erro {
  margin: 0;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.login-aviso {
  margin: 18px 0 0;
  text-align: center;
  color: var(--slate-300);
  font-size: 11px;
  line-height: 1.5;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--slate-800);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.brand-marca {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: .3px;
  font-weight: 700;
  line-height: 1.1;
}

.topbar .brand small {
  color: #94A3B8;
  font-size: 10.5px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, .06);
  border-radius: 8px;
  padding: 3px;
}

.tab-btn {
  border: 0;
  background: transparent;
  color: #CBD5E1;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
}

.tab-btn:hover { color: #fff; }
.tab-btn.ativo { background: var(--teal-600); color: #fff; }

.acoes-topo {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   DROPDOWNS
   ============================================================ */

.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--slate-200);
  padding: 6px;
  z-index: 80;
  animation: subir .15s ease-out;
}

.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--slate-800);
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
}

.dropdown-menu button:hover { background: var(--slate-50); }

.dropdown-menu button.danger { color: var(--red-500); }
.dropdown-menu button.danger:hover { background: #FEF2F2; }

/* ============================================================
   USUÁRIO LOGADO
   ============================================================ */

.usuario-botao {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  cursor: pointer;
  color: #fff;
  transition: background .15s;
}

.usuario-botao:hover { background: rgba(255, 255, 255, .14); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal-600);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.usuario-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.usuario-nome { font-size: 12.5px; font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.usuario-role { font-size: 10px; color: #94A3B8; text-transform: uppercase; letter-spacing: .5px; }

.seta { color: #94A3B8; font-size: 10px; }

/* ============================================================
   BOTÕES
   ============================================================ */

.btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter .15s, transform .05s;
  background: var(--slate-200);
  color: var(--slate-800);
}

.btn:hover { filter: brightness(.96); }
.btn:active { transform: scale(.98); }

.btn-teal { background: var(--teal-600); color: #fff; }
.btn-teal:hover { background: var(--teal-700); }
.btn-emerald { background: var(--emerald-500); color: #fff; }
.btn-ghost { background: transparent; color: #CBD5E1; border: 1px solid rgba(255,255,255,.25); }
.btn-ghost:hover { color: #fff; border-color: rgba(255,255,255,.5); }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* ============================================================
   CONTEÚDO
   ============================================================ */

main { padding: 20px; max-width: 1600px; margin: 0 auto; }

.aba { display: none; }
.aba.ativa { display: block; animation: fadeIn .25s ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.card-panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--slate-800);
}

/* ============================================================
   KANBAN
   ============================================================ */

.kanban {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  flex: 0 0 285px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kanban-col.recuada { opacity: .6; }

.kanban-col-header {
  padding: 12px 14px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 1px 0 rgba(255,255,255,.6);
}

.kanban-col-header .bolinha {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-col-header h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--slate-800);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.kanban-col-header .contagem {
  margin-left: auto;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.kanban-col-header .valor-col {
  font-size: 10.5px;
  color: var(--slate-500);
  font-weight: 700;
}

.kanban-col-body {
  padding: 10px;
  overflow-y: auto;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.kanban-col-body.drag-over {
  outline: 2px dashed var(--teal-600);
  outline-offset: -2px;
  background: #ECFDF5;
}

.k-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--slate-500);
  border-radius: 10px;
  padding: 11px 13px;
  cursor: grab;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
  user-select: none;
  animation: cardIn .22s ease-out;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.k-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.k-card.arrastando { opacity: .4; }

.k-card .nome {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--slate-900);
  margin-bottom: 2px;
}

.k-card .bairro {
  font-size: 11.5px;
  color: var(--slate-500);
  margin-bottom: 9px;
}

.k-card .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.chip {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  letter-spacing: .2px;
}

.chip-contato {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.k-card .linha-valores {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--slate-700);
}

.k-card .cache { font-weight: 800; font-size: 12.5px; }

.k-card .prob {
  font-weight: 800;
  font-size: 12.5px;
}

.prob-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--slate-100);
  margin-top: 7px;
  overflow: hidden;
}

.prob-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .35s ease;
}

.k-card .rodape {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--slate-200);
}

.k-card .rodape .contato {
  font-size: 11px;
  color: var(--slate-500);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-card-acoes { display: flex; gap: 4px; }

.k-card-acoes button {
  border: 0;
  background: var(--slate-100);
  color: var(--slate-700);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.k-card-acoes button:hover { background: var(--slate-200); }
.k-card-acoes button:disabled { opacity: .3; cursor: default; }

.k-col-vazia {
  border: 2px dashed var(--slate-200);
  border-radius: 8px;
  color: var(--slate-300);
  text-align: center;
  padding: 22px 10px;
  font-size: 11.5px;
  line-height: 1.6;
}

/* ============================================================
   TABELA
   ============================================================ */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

.toolbar input[type="search"],
.toolbar select {
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: #fff;
  color: var(--slate-900);
}

.toolbar input[type="search"] { flex: 1; min-width: 200px; }
.toolbar input[type="search"]:focus,
.toolbar select:focus { outline: 2px solid var(--teal-600); outline-offset: -1px; border-color: transparent; }

.contagem-linha {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--slate-500);
}

.contagem-linha strong { color: var(--slate-800); }

.tabela-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--slate-200); }

table.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: #fff;
}

table.tabela thead th {
  background: var(--slate-800);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

table.tabela tbody tr:nth-child(even) { background: var(--slate-50); }

table.tabela tbody tr { transition: background .1s; }

table.tabela tbody tr:hover { background: #ECFDF5; cursor: pointer; }

table.tabela td {
  padding: 9px 12px;
  border-top: 1px solid var(--slate-200);
  vertical-align: middle;
}

table.tabela td .sub { color: var(--slate-500); font-size: 11px; }

.sem-resultados { padding: 34px; text-align: center; color: var(--slate-500); }

.badge-estagio {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-linha {
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

.btn-linha:hover { border-color: var(--teal-600); color: var(--teal-700); }

/* ============================================================
   KPIs
   ============================================================ */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
}

.kpi .rotulo {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--slate-500);
  margin-bottom: 6px;
}

.kpi .valor {
  font-size: 21px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.15;
}

.kpi .sub { font-size: 11px; color: var(--slate-500); margin-top: 4px; }

/* ============================================================
   GRÁFICOS
   ============================================================ */

.grid-graficos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.grafico { min-height: 260px; }

.grafico svg { width: 100%; height: auto; animation: fadeIn .3s ease-out; }

.legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--slate-700);
}

.legenda .item { display: inline-flex; align-items: center; gap: 5px; }

.legenda .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ============================================================
   MODAIS
   ============================================================ */

.modal-fundo {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal-fundo.aberto { display: flex; }

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-lg);
  animation: subir .18s ease-out;
}

.modal.largo { max-width: 860px; }

@keyframes subir {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
}

.modal-cabecalho h2 {
  margin: 0;
  font-size: 15.5px;
  color: var(--slate-800);
}

.modal-fechar {
  border: 0;
  background: var(--slate-100);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 14px;
  color: var(--slate-700);
  transition: background .15s;
}

.modal-fechar:hover { background: var(--slate-200); }

.modal-corpo { padding: 18px 20px; }

.modal-rodape {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--slate-200);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 14px;
}

.campo { display: flex; flex-direction: column; gap: 4px; }
.campo.linha-toda { grid-column: 1 / -1; }

.campo label {
  font-size: 11px;
  font-weight: 800;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.campo input,
.campo select,
.campo textarea {
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--slate-900);
  transition: border-color .15s;
}

.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: 2px solid var(--teal-600);
  outline-offset: -1px;
  border-color: transparent;
}

.campo textarea { resize: vertical; min-height: 70px; }

.prob-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prob-slider input[type="range"] { flex: 1; accent-color: var(--teal-600); }

.prob-slider .prob-valor {
  min-width: 52px;
  text-align: right;
  font-weight: 800;
  color: var(--teal-700);
}

/* ============================================================
   GESTÃO DE USUÁRIOS
   ============================================================ */

.titulo-secao { margin: 4px 0 12px; font-size: 13px; color: var(--slate-700); }

.lista-usuarios {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.linha-usuario {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--slate-50);
}

.linha-usuario .avatar { width: 34px; height: 34px; font-size: 12.5px; }

.linha-usuario .u-info { flex: 1; min-width: 0; }

.linha-usuario .u-nome { font-weight: 700; font-size: 13px; color: var(--slate-900); }

.linha-usuario .u-usuario { font-size: 11.5px; color: var(--slate-500); }

.badge-role {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-radius: 999px;
  padding: 2px 9px;
}

.badge-role.admin { background: #ECFDF5; color: var(--teal-700); border: 1px solid #A7F3D0; }
.badge-role.user { background: var(--slate-100); color: var(--slate-500); border: 1px solid var(--slate-200); }

.linha-usuario .u-acoes { display: flex; gap: 6px; }

.self { font-size: 10px; color: var(--teal-700); font-weight: 700; }

hr { border: 0; border-top: 1px solid var(--slate-200); margin: 16px 0; }

/* ============================================================
   ESTRATÉGIA
   ============================================================ */

.grupo-estrategia { margin-bottom: 22px; }

.grupo-estrategia > h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--slate-800);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.dica-estrategia {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--teal-600);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--slate-700);
  margin-bottom: 12px;
  line-height: 1.5;
}

.pitch {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.pitch .pitch-titulo {
  font-weight: 700;
  font-size: 13px;
  color: var(--slate-900);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pitch p {
  margin: 0 0 4px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--slate-700);
}

.pitch .passo {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-700);
  margin-top: 6px;
}

/* ============================================================
   TOAST
   ============================================================ */

#toast-area {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--slate-800);
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: subir .2s ease-out;
  max-width: 320px;
}

.toast.sucesso { background: var(--teal-700); }
.toast.erro { background: var(--red-500); }

/* ============================================================
   RODAPÉ
   ============================================================ */

footer {
  text-align: center;
  color: var(--slate-500);
  font-size: 11.5px;
  padding: 18px 0 30px;
}

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
