:root {
  --bg: #070b14;
  --card: #0f1626;
  --line: #243049;
  --text: #e8eefc;
  --muted: #93a0b8;
  --accent: #2f6fed;
  --accent-bright: #4ea8ff;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --font: "Outfit", ui-sans-serif, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1e293b 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}
a { color: #93c5fd; }
code, .key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
h1, h2 { margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0; }
.card {
  background: color-mix(in srgb, var(--card) 92%, white 0%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1324;
  color: var(--text);
  padding: 10px 12px;
}
button, .btn {
  background: var(--accent);
  border: none;
  color: white;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
}
button.danger { background: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.grid .full { grid-column: 1 / -1; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge.active { background: rgba(34,197,94,.15); color: #86efac; }
.badge.suspended { background: rgba(245,158,11,.15); color: #fcd34d; }
.badge.expired { background: rgba(239,68,68,.15); color: #fca5a5; }
.flash, .alert {
  background: rgba(59,130,246,.15);
  border: 1px solid rgba(59,130,246,.35);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.alert { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fecaca; }
details summary { cursor: pointer; color: #93c5fd; }
.edit { display: grid; gap: 8px; margin: 10px 0; max-width: 320px; }
.check { display: flex; align-items: center; gap: 8px; }
.muted-box { color: var(--muted); }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

/* ========== Login (estilo card centralizado) ========== */
html:has(body.auth) {
  height: 100%;
}
body.auth {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #0a0a0b;
  font-family: var(--font);
  color: #e8e8ed;
}
.auth-glow {
  position: absolute;
  width: min(520px, 80vw);
  height: min(520px, 80vw);
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
.auth-glow--blue {
  left: -12%;
  bottom: -18%;
  background: rgba(59, 130, 246, 0.28);
  opacity: 0.85;
}
.auth-glow--amber {
  right: -10%;
  top: -16%;
  background: rgba(245, 158, 11, 0.18);
  opacity: 0.75;
}
.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 24px 18px;
  display: flex;
  justify-content: center;
}
.auth-card {
  width: 100%;
  padding: 40px 36px 28px;
  border-radius: 18px;
  background: rgba(22, 22, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: auth-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes auth-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}
.auth-logo {
  display: block;
  width: min(300px, 88%);
  height: auto;
  max-height: 120px;
  object-fit: contain;
  object-position: center;
  animation: auth-logo 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}
@keyframes auth-logo {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.auth-heading {
  text-align: center;
  margin-bottom: 28px;
}
.auth-heading h1 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}
.auth-heading p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 400;
  color: #9ca3af;
  line-height: 1.4;
}
.auth-alert {
  margin: 0 0 18px;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fecaca;
  font-size: 0.875rem;
  text-align: center;
}
.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.auth-label {
  display: block;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ca3af;
}
.auth-input {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 10, 12, 0.85);
  color: #f3f4f6;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-input::placeholder {
  color: #6b7280;
}
.auth-input:focus {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 4px 0 0;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.28);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.auth-submit:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}
.auth-submit:active {
  transform: translateY(0);
}
.auth-foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.4;
}
@media (max-width: 480px) {
  .auth-card { padding: 32px 22px 24px; }
  .auth-heading h1 { font-size: 1.35rem; }
  .auth-logo { max-height: 100px; width: min(280px, 90%); }
}

/* ========== App shell (painel) ========== */
body.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  background: #070b14;
  font-family: var(--font);
}
.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0c1424 0%, #080e1a 100%);
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(36, 48, 73, 0.8);
}
.app-brand-logo {
  width: 72px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.app-brand strong {
  display: block;
  font-size: 0.95rem;
  color: #fff;
  line-height: 1.2;
}
.app-brand span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.app-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: #b6c2d9;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav a:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #fff;
}
.app-nav a.active {
  background: rgba(47, 111, 237, 0.22);
  color: #fff;
  border: 1px solid rgba(78, 168, 255, 0.25);
}
.app-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(36, 48, 73, 0.8);
}
.app-user-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}
.app-user-role {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-top {
  padding: 22px 28px 8px;
}
.app-top h1 {
  margin: 0 0 4px;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
}
.app-content {
  padding: 8px 28px 32px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: rgba(15, 22, 38, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.stat-meta {
  font-size: 0.8rem;
  color: #7f8da8;
}
.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.dash-columns {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters input[type="search"],
.filters select {
  min-width: 160px;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-columns { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body.app {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .app-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .app-content, .app-top {
    padding-left: 18px;
    padding-right: 18px;
  }
  .grid-2 { grid-template-columns: 1fr; }
}
