* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  line-height: 1.5;
}

/* ===== LOGIN ===== */
.tela-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  padding: 20px;
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.logo { font-size: 28px; font-weight: 800; text-align: center; color: #4f46e5; }
.subtitulo { text-align: center; color: #6b7280; margin: 8px 0 28px; }
.passo { display: flex; flex-direction: column; gap: 12px; }
.passo.escondido { display: none; }
.passo label { font-weight: 600; font-size: 14px; color: #374151; }
.passo input {
  padding: 14px; border: 2px solid #e5e7eb; border-radius: 8px;
  font-size: 16px; transition: border-color 0.2s;
}
.passo input:focus { outline: none; border-color: #4f46e5; }
.btn-primary {
  background: #4f46e5; color: white; border: none;
  padding: 14px; border-radius: 8px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover:not(:disabled) { background: #4338ca; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: #6b7280; border: 2px solid #e5e7eb;
  padding: 12px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.btn-ghost:hover { background: #f9fafb; }
.info-codigo { background: #ecfdf5; color: #065f46; padding: 12px; border-radius: 8px; font-size: 14px; text-align: center; }
.msg-login { margin-top: 16px; padding: 12px; border-radius: 8px; font-size: 14px; }
.msg-login.erro { background: #fef2f2; color: #991b1b; }
.msg-login.ok { background: #ecfdf5; color: #065f46; }

/* ===== DASHBOARD ===== */
.topo {
  background: white; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky; top: 0; z-index: 10;
}
.topo .logo { font-size: 20px; text-align: left; }
.topo .acoes { display: flex; gap: 12px; align-items: center; }
.topo .acoes a { color: #4f46e5; text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 6px; }
.topo .acoes a:hover { background: #eef2ff; }
.topo .acoes button { background: transparent; border: 1px solid #e5e7eb; padding: 8px 14px; border-radius: 6px; cursor: pointer; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 24px; margin-bottom: 4px; }
.subtitulo-pg { color: #6b7280; margin-bottom: 24px; }

/* Cards de métricas */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.card {
  background: white; padding: 20px; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 4px solid #4f46e5;
}
.card.verde { border-left-color: #10b981; }
.card.amarelo { border-left-color: #f59e0b; }
.card.vermelho { border-left-color: #ef4444; }
.card.roxo { border-left-color: #7c3aed; }
.card .titulo { font-size: 13px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.card .valor { font-size: 32px; font-weight: 800; margin-top: 6px; color: #111827; }
.card .legenda { font-size: 12px; color: #9ca3af; margin-top: 4px; }

.secao-titulo { font-size: 18px; font-weight: 700; margin: 24px 0 12px; color: #1f2937; }

/* Tabela */
.tabela-wrap { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.busca-bar { padding: 16px; border-bottom: 1px solid #e5e7eb; }
.busca-bar input {
  width: 100%; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px;
}
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; font-size: 14px; }
table th { background: #f9fafb; font-weight: 600; color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
table tr { border-bottom: 1px solid #f3f4f6; }
table tr:hover { background: #f9fafb; cursor: pointer; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge.ativo { background: #d1fae5; color: #065f46; }
.badge.trial { background: #fef3c7; color: #92400e; }
.badge.cancelado { background: #fee2e2; color: #991b1b; }
.badge.master { background: #ede9fe; color: #5b21b6; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal-overlay.aberto { display: flex; }
.modal {
  background: white; border-radius: 12px; max-width: 700px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 20px; }
.modal-header .fechar { background: transparent; border: none; font-size: 24px; cursor: pointer; color: #6b7280; }
.modal-body { padding: 24px; }
.detalhe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 24px; }
.detalhe-grid > div span:first-child { display: block; font-size: 12px; color: #6b7280; font-weight: 600; }
.detalhe-grid > div span:last-child { font-weight: 600; }
.stats-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-mini { background: #f9fafb; padding: 12px; border-radius: 8px; text-align: center; }
.stat-mini .v { font-size: 20px; font-weight: 700; color: #4f46e5; }
.stat-mini .l { font-size: 11px; color: #6b7280; margin-top: 2px; }
.acoes-tenant { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.acoes-tenant button { padding: 8px 14px; border-radius: 6px; border: 1px solid #e5e7eb; background: white; cursor: pointer; font-weight: 600; font-size: 13px; }
.acoes-tenant .btn-vitalicio { background: #ecfdf5; color: #065f46; border-color: #86efac; }
.acoes-tenant .btn-trial { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.acoes-tenant .btn-cancelar { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }

.loader { text-align: center; padding: 40px; color: #6b7280; }
.empty { text-align: center; padding: 40px; color: #9ca3af; }

/* Mobile */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .topo { padding: 12px 16px; }
  table { font-size: 12px; }
  table th:nth-child(3), table td:nth-child(3) { display: none; } /* esconde email no mobile */
}
