:root {
  --bg:        #0b0f1a;
  --bg-soft:   #121829;
  --card:      #161d33;
  --card-2:    #1b2440;
  --border:    #243056;
  --text:      #e8edff;
  --muted:     #8a96b8;
  --accent:    #5b8cff;
  --accent-2:  #7c5bff;
  --green:     #2dd4a7;
  --green-glow:rgba(45, 212, 167, 0.45);
  --amber:     #ffb454;
  --pink:      #ff6b9d;
  --radius:    16px;
  --shadow:    0 10px 30px rgba(0, 0, 0, 0.35);
  font-synthesis: none;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 91, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(91, 140, 255, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; }

/* ---------- Cabeçalho ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.brand .logo svg { width: 24px; height: 24px; }
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.brand p  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.status {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  padding: 9px 14px; border-radius: 999px; font-size: 13px; color: var(--muted);
}
.status .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 var(--green-glow); animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--green-glow); }
  70%  { box-shadow: 0 0 0 9px rgba(45, 212, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0); }
}

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* ---------- Card destaque: ONLINE AGORA ---------- */
.online-hero {
  grid-column: span 5;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(45, 212, 167, 0.18), transparent 60%),
    linear-gradient(180deg, var(--card-2), var(--bg-soft));
  display: flex; flex-direction: column; justify-content: space-between;
}
.online-hero .big {
  font-size: 76px; font-weight: 800; line-height: 1; letter-spacing: -2px;
  background: linear-gradient(135deg, #fff, var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 6px 0 2px;
}
.online-hero .sub { color: var(--muted); font-size: 14px; }
.online-hero .live-badge {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  background: rgba(45, 212, 167, 0.12); border: 1px solid rgba(45, 212, 167, 0.35);
  color: var(--green); font-size: 11.5px; font-weight: 700; letter-spacing: 1px;
  padding: 5px 11px; border-radius: 999px; text-transform: uppercase;
}
.online-hero .live-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: pulse 1.6s infinite;
}
.devices { display: flex; gap: 10px; margin-top: 18px; }
.device-pill {
  flex: 1; background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; text-align: center;
}
.device-pill .n { font-size: 22px; font-weight: 700; }
.device-pill .l { font-size: 11px; color: var(--muted); margin-top: 3px;
  text-transform: uppercase; letter-spacing: 0.5px; }

/* ---------- KPIs ---------- */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .value { font-size: 38px; font-weight: 800; letter-spacing: -1px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .trend { font-size: 12px; color: var(--green); margin-top: 6px; }
.kpi-icon {
  position: absolute; top: 16px; right: 16px; width: 38px; height: 38px;
  border-radius: 10px; display: grid; place-items: center; opacity: 0.9;
}
.kpi-icon.blue  { background: rgba(91,140,255,0.15);  color: var(--accent); }
.kpi-icon.green { background: rgba(45,212,167,0.15);  color: var(--green); }
.kpi-icon.amber { background: rgba(255,180,84,0.15);  color: var(--amber); }
.kpi-icon svg { width: 20px; height: 20px; }

/* ---------- Gráfico ao vivo ---------- */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; margin-top: 6px; }
.bar {
  flex: 1; min-height: 3px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transition: height 0.6s cubic-bezier(.2,.8,.2,1); opacity: 0.92;
}
.bar:last-child { background: linear-gradient(180deg, var(--green), #1aa37e); }
.chart-axis {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 11px; margin-top: 10px;
}

/* ---------- Listas (top páginas, origens, online) ---------- */
.list { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 10px; position: relative;
}
.row:hover { background: rgba(255,255,255,0.03); }
.row .meter {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px;
  background: linear-gradient(90deg, rgba(91,140,255,0.16), rgba(124,91,255,0.05));
  z-index: 0;
}
.row > * { position: relative; z-index: 1; }
.row .label {
  flex: 1; font-size: 13.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text);
}
.row .count { font-weight: 700; font-size: 14px; color: var(--text); }
.row .badge {
  font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 600;
  background: rgba(255,255,255,0.06); color: var(--muted);
}
.row .badge.mobile  { background: rgba(255,107,157,0.15); color: var(--pink); }
.row .badge.tablet  { background: rgba(255,180,84,0.15);  color: var(--amber); }
.row .badge.desktop { background: rgba(91,140,255,0.15);  color: var(--accent); }

.empty { color: var(--muted); font-size: 13px; padding: 16px 8px; text-align: center; }

.idle { font-size: 11px; color: var(--muted); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }

footer {
  margin-top: 32px; text-align: center; color: var(--muted); font-size: 12.5px;
}
footer code {
  background: var(--card); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 6px; color: var(--accent);
}

/* ---------- Responsivo ---------- */
@media (max-width: 980px) {
  .col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.online-hero { grid-column: span 12; }
}
.fade { animation: fade 0.4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ==================== AUTENTICAÇÃO ==================== */
.auth-body {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 410px;
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: 20px; padding: 34px 30px;
  box-shadow: var(--shadow);
}
.auth-title { font-size: 22px; text-align: center; margin-top: 8px; }
.auth-sub { color: var(--muted); font-size: 13.5px; text-align: center; margin: 6px 0 18px; }
.tabs { display: flex; gap: 6px; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: 12px; padding: 5px; margin-bottom: 18px; }
.tab { flex: 1; text-align: center; padding: 9px; border-radius: 9px; text-decoration: none;
  color: var(--muted); font-size: 14px; font-weight: 600; transition: .2s; }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
form label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
form input, .site-form input, select {
  width: 100%; padding: 12px 14px; border-radius: 11px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; transition: border .2s, box-shadow .2s;
}
form input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,140,255,.18); }
form button, .site-form button {
  width: 100%; margin-top: 18px; padding: 13px; border: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 15px; font-weight: 700; font-family: inherit; transition: transform .1s, filter .2s;
}
form button:hover { filter: brightness(1.08); }
form button:active { transform: translateY(1px); }
.alert { padding: 12px 14px; border-radius: 11px; font-size: 13.5px; margin-bottom: 16px; }
.alert-ok  { background: rgba(45,212,167,.12); border: 1px solid rgba(45,212,167,.35); color: var(--green); }
.alert-err { background: rgba(255,107,157,.12); border: 1px solid rgba(255,107,157,.35); color: var(--pink); }

/* ==================== NAVEGAÇÃO ==================== */
.mainnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.navlink { position: relative; text-decoration: none; color: var(--muted); font-size: 14px;
  font-weight: 600; padding: 9px 14px; border-radius: 10px; transition: .2s; }
.navlink:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.navlink.active { color: #fff; background: rgba(91,140,255,0.15); }
.navlink.ghost { border: 1px solid var(--border); }
.navbadge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: 9px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 700; }
.usermenu { display: flex; align-items: center; gap: 10px; margin-left: 6px;
  padding-left: 14px; border-left: 1px solid var(--border); }
.uname { font-size: 13.5px; font-weight: 600; }
.urole { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 6px; }
.urole.superadmin { background: rgba(124,91,255,.18); color: #b6a4ff; }
.urole.user { background: rgba(91,140,255,.15); color: var(--accent); }

/* ==================== ESTADO VAZIO / SITES ==================== */
.empty-state { text-align: center; padding: 48px 30px; }
.empty-emoji { font-size: 54px; margin-bottom: 8px; }
.empty-state h2 { font-size: 22px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0 auto 20px; line-height: 1.6; }
.site-form { max-width: 380px; margin: 0 auto; text-align: left; }
.site-form .field { margin-bottom: 4px; }
.muted-p { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin-bottom: 14px; }
.muted-p code, footer code { background: var(--bg-soft); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px; color: var(--accent); }

.sitebar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px; }
.sitebar-left { display: flex; align-items: center; gap: 12px; }
.mini-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.sitebar select { width: auto; min-width: 240px; }
.newsite summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px;
  list-style: none; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.newsite[open] summary { margin-bottom: 12px; }
.newsite .site-form { margin: 0; max-width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.newsite .site-form button { width: auto; margin-top: 0; padding: 12px 20px; white-space: nowrap; }

/* ==================== SNIPPET ==================== */
.snippet { position: relative; background: #0a0e1a; border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; }
.snippet code { display: block; white-space: pre; overflow-x: auto; font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 12.5px; color: #9fd0ff; line-height: 1.7; }
.copybtn { position: absolute; top: 12px; right: 12px; padding: 7px 14px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 12.5px;
  font-weight: 600; font-family: inherit; }
.copybtn:hover { background: var(--card-2); }
.inline-actions { display: flex; gap: 10px; margin-top: 16px; }
.inline-actions button, .inline button { width: auto; margin-top: 0; padding: 9px 16px; font-size: 13px; }
.btn-soft { background: var(--card-2) !important; border: 1px solid var(--border); color: var(--text) !important; }
.btn-danger { background: rgba(255,107,157,.14) !important; border: 1px solid rgba(255,107,157,.4); color: var(--pink) !important; }
.btn-ok { background: linear-gradient(135deg, var(--green), #1aa37e) !important; }

/* ==================== TABELAS (ADMIN) ==================== */
.section-title { font-size: 17px; font-weight: 700; margin: 4px 0 14px; display: flex; align-items: center; gap: 10px; }
.utable { width: 100%; border-collapse: collapse; }
.utable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); font-weight: 700; padding: 0 14px 12px; border-bottom: 1px solid var(--border); }
.utable td { padding: 14px; border-bottom: 1px solid rgba(36,48,86,.5); font-size: 14px; vertical-align: middle; }
.utable tr:last-child td { border-bottom: 0; }
.utable .muted { color: var(--muted); }
.ta-r { text-align: right; }
.inline { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill-status { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 7px; }
.pill-status.approved { background: rgba(45,212,167,.14); color: var(--green); }
.pill-status.pending  { background: rgba(255,180,84,.14); color: var(--amber); }
.pill-status.rejected { background: rgba(255,107,157,.14); color: var(--pink); }
.badge { font-size: 10px; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--muted); }

@media (max-width: 760px) {
  .newsite .site-form { grid-template-columns: 1fr; }
  .usermenu { border-left: 0; padding-left: 0; }
  .utable { font-size: 12.5px; }
}

/* Cloudflare Turnstile (CAPTCHA) */
.cf-turnstile { margin: 18px 0 0; display: flex; justify-content: center; }
