/* ============================================================
   PAINEL ADMIN — DESIGN SYSTEM (dark SaaS)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0c11;
  --surface: #11151d;
  --surface-2: #171c26;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .13);
  --text: #eceef4;
  --text-dim: #8b93a7;
  --accent: #6366f1;
  --accent-hover: #5558e8;
  --accent-soft: rgba(99, 102, 241, .14);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
}

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

/* Trava de segurança: nenhum SVG pode exceder 24px sem classe própria */
svg { max-width: 24px; max-height: 24px; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }

/* ============ LOGIN ============ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(600px 380px at 50% -10%, rgba(99, 102, 241, .16), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-header h1 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin: 16px 0 4px; }
.login-header p { color: var(--text-dim); font-size: 13px; }

.login-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 19px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 6px 20px rgba(99, 102, 241, .35);
}

.erro-login { color: var(--danger); font-size: 12.5px; margin: -6px 0 14px; }

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.sidebar-logo .login-logo { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; box-shadow: none; }
.sidebar-logo span { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 10px;
  margin-bottom: 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.ativo { background: var(--accent-soft); color: #c7c9ff; border-color: rgba(99, 102, 241, .25); }

.btn-sair {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  margin-top: auto;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
  text-align: left;
}
.btn-sair svg { width: 17px; height: 17px; }
.btn-sair:hover { color: var(--danger); background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .2); }

/* ============ CONTEÚDO ============ */
.conteudo { flex: 1; min-width: 0; padding: 30px 40px 48px; max-width: 1180px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.topbar .crumb { font-size: 12.5px; color: var(--text-dim); }
.topbar .crumb b { color: var(--text); font-weight: 600; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px 5px 6px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.user-chip .avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.secao { display: none; }
.secao.ativa { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.secao-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.secao-header h1 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.secao-header p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* ============ CARDS ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.card h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.card-form { max-width: 560px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============ FORMULÁRIO ============ */
.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-dim); margin-bottom: 7px; }

.campo input, .campo select {
  width: 100%;
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0 13px;
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.campo input::placeholder { color: #565d6e; }
.campo input:focus, .campo select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.campo-linha { display: flex; gap: 14px; }
.campo-linha .campo { flex: 1; }

.campo-toggle { display: flex; flex-direction: column; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; margin-top: 4px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.form-acoes { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ============ BOTÕES ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primario { background: var(--accent); color: #fff; box-shadow: 0 2px 12px rgba(99, 102, 241, .3); }
.btn-primario:hover { background: var(--accent-hover); }
.btn-primario:active { transform: translateY(1px); }

.btn-secundario { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-secundario:hover { border-color: var(--accent); color: #c7c9ff; }

.btn-perigo { background: transparent; border-color: var(--border-strong); color: var(--danger); }
.btn-perigo:hover { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .3); }

.btn-bloco { width: 100%; margin-top: 4px; }

/* ============ STATUS / ALERTAS ============ */
.gateway-status {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 12.5px;
  margin: 4px 0 16px;
}
.gateway-status.ok { background: rgba(52, 211, 153, .08); color: var(--success); border-color: rgba(52, 211, 153, .25); }
.gateway-status.erro { background: rgba(248, 113, 113, .08); color: var(--danger); border-color: rgba(248, 113, 113, .25); }

.alerta {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 12.5px;
  margin-bottom: 20px;
  max-width: 560px;
}
.alerta-info { background: var(--accent-soft); color: #b7bbff; border-color: rgba(99, 102, 241, .25); }
.alerta-erro { background: rgba(248, 113, 113, .08); color: var(--danger); border-color: rgba(248, 113, 113, .25); max-width: none; }

/* ============ TABELA / BADGES ============ */
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { text-align: left; color: var(--text-dim); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tabela td { padding: 10px; border-bottom: 1px solid var(--border); }
.tabela tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.pago { background: rgba(52, 211, 153, .12); color: var(--success); }
.badge.pendente { background: rgba(251, 191, 36, .12); color: var(--warning); }
.badge.cancelado { background: rgba(248, 113, 113, .12); color: var(--danger); }

/* ============ RESPONSIVO ============ */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .sidebar-logo { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
  .nav-label { display: none; }
  .sidebar-nav { flex-direction: row; flex: 1; }
  .conteudo { padding: 22px 18px 40px; }
}
