/* ============================================================
   Partners Truth Commerce — Identidade visual Truth Commerce
   ============================================================ */
:root {
  --verde: #22c55e;
  --verde-escuro: #16a34a;
  --verde-claro: #dcfce7;
  --sidebar-bg: #101418;
  --sidebar-hover: #1a2027;
  --fundo: #f5f7f9;
  --card: #ffffff;
  --borda: #e5e9ee;
  --texto: #1c2430;
  --texto-suave: #6b7684;
  --azul: #2563eb;
  --azul-claro: #dbeafe;
  --amarelo: #f7d154;
  --amarelo-claro: #fdf3d0;
  --laranja: #f97316;
  --laranja-claro: #ffedd5;
  --vermelho: #dc2626;
  --vermelho-claro: #fee2e2;
  --raio: 12px;
  --sombra: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

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

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  background: var(--sidebar-bg);
  color: #cdd5de;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo-icone { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.sidebar-logo strong { color: #fff; font-size: 14px; display: block; line-height: 1.2; }
.sidebar-logo span { font-size: 11px; color: var(--verde); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }

.sidebar-nav { padding: 18px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  font-size: 11px;
  text-transform: lowercase;
  color: #7a8494;
  padding: 6px 10px;
  letter-spacing: .3px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cdd5de;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active {
  background: var(--sidebar-hover);
  color: var(--verde);
  box-shadow: inset 3px 0 0 var(--verde);
}

.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--verde);
  color: #08210f;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-info strong { display: block; color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: 11px; color: #7a8494; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sair {
  display: flex; align-items: center; gap: 8px;
  color: #9aa4b2; text-decoration: none; font-size: 13px;
  padding: 6px 4px; border-radius: 6px;
}
.sair:hover { color: #fff; }

.content { flex: 1; padding: 28px 32px; min-width: 0; }

/* ---------- Cabeçalho da página ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--texto-suave); font-size: 13px; margin-top: 2px; }

/* ---------- Cards de estatística ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--sombra);
}
.stat-label { font-size: 12.5px; color: var(--texto-suave); display: block; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-value-moeda { font-size: 18px; white-space: nowrap; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-blue   { background: var(--azul-claro);    color: var(--azul); }
.icon-yellow { background: var(--amarelo-claro); color: #b8860b; }
.icon-orange { background: var(--laranja-claro); color: var(--laranja); }
.icon-green  { background: var(--verde-claro);   color: var(--verde-escuro); }

/* ---------- Card / tabela ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 22px 24px;
  box-shadow: var(--sombra);
  margin-bottom: 24px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.card-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.card-toolbar .card-title { margin-bottom: 0; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.filtros input[type=search] { min-width: 240px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--texto-suave);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--borda);
  background: #fafbfc;
  white-space: nowrap;
}
td { padding: 13px 12px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td small { color: var(--texto-suave); }
.empty { text-align: center; color: var(--texto-suave); padding: 32px 12px !important; }
.acoes-cell { white-space: nowrap; }
.inline { display: inline; }

/* ---------- Badges e textos de status ---------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-info    { background: var(--azul-claro);    color: var(--azul); }
.badge-warn    { background: var(--amarelo-claro); color: #8a6d0b; }
.badge-orange  { background: var(--laranja-claro); color: #c2570c; }
.badge-success { background: var(--verde-claro);   color: var(--verde-escuro); }
.badge-danger  { background: var(--vermelho-claro);color: var(--vermelho); }

.text-green { color: var(--verde-escuro); font-weight: 600; }
.text-blue  { color: var(--azul); font-weight: 600; }
.text-muted { color: var(--texto-suave); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 8px;
  transition: filter .15s, background .15s;
}
.btn-primary { background: var(--verde); color: #08210f; }
.btn-primary:hover { background: var(--verde-escuro); color: #fff; }
.btn-ghost { background: #eef1f4; color: var(--texto); }
.btn-ghost:hover { background: #e2e7ec; }
.btn-dark { background: #2b3440; color: #fff; }
.btn-dark:hover { filter: brightness(1.15); }
.btn-block { width: 100%; justify-content: center; }
.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--azul); font-family: inherit; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 6px; border-radius: 6px;
}
.btn-link:hover { background: var(--azul-claro); }

/* ---------- Formulários ---------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 12px; }
label small { color: var(--texto-suave); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=search], select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--texto);
  background: #fff;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .15);
}
.filtros input, .filtros select { margin-top: 0; width: auto; }
textarea { resize: vertical; }
fieldset {
  border: none;
  background: #f8fafb;
  border: 1px solid var(--borda);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
legend { font-size: 13.5px; font-weight: 600; padding: 0 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Modais ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(12, 18, 26, .55);
  display: none;
  align-items: flex-start; justify-content: center;
  padding: 4vh 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal-overlay.aberto { display: flex; }
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: subir .2s ease;
}
.modal-lg { max-width: 860px; }
@keyframes subir { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--borda);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-header-brand {
  background: var(--sidebar-bg);
  color: #fff;
  border-radius: 14px 14px 0 0;
  border-bottom: 3px solid var(--verde);
}
.modal-sub { font-size: 12.5px; opacity: .75; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: inherit; opacity: .6;
}
.modal-close:hover { opacity: 1; }
.modal-body { padding: 22px 24px; max-height: 72vh; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 8px;
}
.modal > .modal-footer { padding: 16px 24px; border-top: 1px solid var(--borda); }

/* ---------- Detalhe da indicação ---------- */
.detalhe-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 720px) { .detalhe-grid { grid-template-columns: 1fr; } }
.detalhe-col { display: flex; flex-direction: column; gap: 14px; }
.mini-card {
  border: 1px solid var(--borda);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
}
.mini-card h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.mini-card-green { background: #f2fdf6; border-color: #bbe9cd; }
.kv { margin-bottom: 10px; }
.kv:last-child { margin-bottom: 0; }
.kv span {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--texto-suave); margin-bottom: 2px;
}
.kv strong { font-weight: 500; font-size: 13.5px; word-break: break-word; }
.kv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.comissao-valor { font-size: 22px !important; font-weight: 700 !important; color: var(--verde-escuro); }

.funil-circulo {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--amarelo);
  color: #6b5407;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  margin: 4px auto 10px;
}
.funil-circulo.f4 { background: var(--verde); color: #08210f; }
.funil-circulo.f5 { background: var(--vermelho-claro); color: var(--vermelho); }
.funil-label { text-align: center; font-size: 12.5px; color: var(--texto-suave); }

.historico { list-style: none; }
.historico li { padding: 8px 0; border-bottom: 1px dashed var(--borda); font-size: 12.5px; }
.historico li:last-child { border-bottom: none; }
.historico li small { display: block; color: var(--texto-suave); margin-top: 2px; }

/* ---------- Mensagens flash ---------- */
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 500;
}
.flash-success { background: var(--verde-claro); color: var(--verde-escuro); border: 1px solid #bbe9cd; }
.flash-error { background: var(--vermelho-claro); color: var(--vermelho); border: 1px solid #f5c2c2; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 600px at 70% -10%, #1d2b22 0%, var(--sidebar-bg) 55%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 36px 34px 28px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 70px rgba(0,0,0,.4);
  text-align: center;
}
.login-logo-img {
  width: 100%;
  max-width: 230px;
  margin: 0 auto 4px;
  display: block;
}
.login-card h1 { font-size: 20px; font-weight: 700; }
.login-card h1 span {
  color: var(--verde-escuro);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 15px;
}
.login-sub { color: var(--texto-suave); font-size: 13px; margin: 6px 0 22px; }
.login-card form { text-align: left; }
.login-card .btn { margin-top: 6px; }
.login-footer { margin-top: 20px; font-size: 11.5px; color: var(--texto-suave); }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 10px 12px; }
  .nav-group { display: none; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; }
  .sidebar-user { margin-bottom: 0; }
  .content { padding: 20px 16px; }
}
