/* ─── Variáveis ─────────────────────────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --card:        #21262d;
  --border:      #30363d;
  --text:        #e6edf3;
  --text2:       #8b949e;
  --blue:        #58a6ff;
  --green:       #3fb950;
  --red:         #f85149;
  --yellow:      #d29922;
  --orange:      #db6d28;
  --purple:      #bc8cff;
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --radius:      8px;
  --shadow:      0 4px 16px rgba(0,0,0,.5);
  --shadow-sm:   0 1px 4px rgba(0,0,0,.4);
  --trans:       .18s ease;
}

/* ─── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
code {
  font-family: 'SF Mono', Consolas, 'Courier New', monospace;
  font-size: 13px;
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blue);
}
pre {
  background: var(--bg);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: 'SF Mono', Consolas, 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.65;
}

/* Scrollbar customizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.content-area { padding: 1.5rem; flex: 1; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--trans);
}
.sidebar-logo {
  padding: 1.1rem 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  letter-spacing: -.01em;
  flex-shrink: 0;
}
.sidebar-logo i {
  color: var(--red);
  font-size: 1.4rem;
  filter: drop-shadow(0 0 6px rgba(248,81,73,.5));
}
.sidebar-menu { list-style: none; padding: .6rem 0; flex: 1; overflow-y: auto; }
.sidebar-menu li { position: relative; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  color: var(--text2);
  border-radius: var(--radius);
  margin: 1px .5rem;
  transition: background var(--trans), color var(--trans);
  font-size: .875rem;
}
.sidebar-menu li a:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
  text-decoration: none;
}
.sidebar-menu li.active a {
  background: rgba(88,166,255,.12);
  color: var(--blue);
  font-weight: 500;
}
.sidebar-menu li.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}
.sidebar-menu li a i { width: 16px; text-align: center; font-size: .85rem; }
.sidebar-footer { padding: .75rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.sidebar-footer a {
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  transition: all var(--trans);
}
.sidebar-footer a:hover { background: rgba(248,81,73,.1); color: var(--red); text-decoration: none; }
.badge-count {
  background: var(--red);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  line-height: 1.4;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(22,27,34,.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: .95rem; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.topbar-icon {
  color: var(--text2);
  font-size: 1.05rem;
  padding: .35rem .4rem;
  position: relative;
  border-radius: var(--radius);
  transition: all var(--trans);
  line-height: 1;
}
.topbar-icon:hover { color: var(--text); background: rgba(255,255,255,.06); text-decoration: none; }
.notif-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--bg2);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text2);
  font-size: .82rem;
  background: rgba(255,255,255,.04);
  padding: .28rem .65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.topbar-clock {
  color: var(--text2);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; padding: .25rem; }
.plan-badge { font-size: .62rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: .04em; }
.plan-free       { background: rgba(139,148,158,.15); color: var(--text2); }
.plan-pro        { background: rgba(88,166,255,.15); color: var(--blue); }
.plan-enterprise { background: rgba(188,140,255,.15); color: var(--purple); }
.plan-starter    { background: rgba(63,185,80,.15); color: var(--green); }
.plan-business   { background: rgba(219,109,40,.15); color: var(--orange); }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.card-header h3 {
  font-size: .875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.card-header h3 i { color: var(--blue); }

/* ─── Formulários dentro de cards (sem classe no form) ─────────────────────── */
/* Cards cujo form segue um card-header precisam de padding próprio */
.card > form:not([class]) { padding: 1.25rem; }
.card > form:not([class]) > textarea { margin-bottom: .75rem; }

/* Webhook form tem classe mas precisa de padding */
.webhook-form { padding: 1.25rem; }

/* ─── Stats Grid ──────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--trans), transform var(--trans), box-shadow var(--trans);
}
.stat-card:hover {
  border-color: rgba(88,166,255,.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.icon-blue    { background: rgba(88,166,255,.12); color: var(--blue); }
.icon-red     { background: rgba(248,81,73,.12);  color: var(--red); }
.icon-yellow  { background: rgba(210,153,34,.12); color: var(--yellow); }
.icon-green   { background: rgba(63,185,80,.12);  color: var(--green); }
.icon-critical{ background: rgba(248,81,73,.2);   color: #ff6e6e; }
.stat-value { display: block; font-size: 1.75rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.stat-label { display: block; color: var(--text2); font-size: .78rem; margin-top: .25rem; }

/* ─── Charts ──────────────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
/* CORREÇÃO: cards no charts-grid têm card-header; não pode ter padding no card */
.charts-grid .card { padding: 0; }
.charts-grid .card canvas {
  display: block;
  padding: .75rem 1.25rem 1.25rem;
  box-sizing: border-box;
  width: 100% !important;
}

.tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ─── Tabelas ─────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  font-weight: 600;
  background: rgba(255,255,255,.015);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.025); }
.data-table td:first-child, .data-table th:first-child { padding-left: 1.25rem; }
.data-table td:last-child,  .data-table th:last-child  { padding-right: 1.25rem; }
.row-disabled { opacity: .45; }
.text-center { text-align: center; }
.text-muted  { color: var(--text2); }
.actions     { white-space: nowrap; }

/* ─── Badges de Severidade ────────────────────────────────────────────────────── */
.severity-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-low      { background: rgba(63,185,80,.13);  color: var(--green); }
.badge-medium   { background: rgba(210,153,34,.13); color: var(--yellow); }
.badge-high     { background: rgba(248,81,73,.13);  color: var(--red); }
.badge-critical { background: rgba(248,81,73,.22);  color: #ff6e6e; border: 1px solid rgba(248,81,73,.35); }

/* ─── Botões ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover  { background: #4a8fe0; border-color: #4a8fe0; }
.btn-danger   { background: var(--red);  color: #fff; border-color: var(--red); }
.btn-danger:hover   { background: #df4340; border-color: #df4340; }
.btn-outline  { background: transparent; color: var(--text2); border-color: var(--border); }
.btn-outline:hover  { background: rgba(255,255,255,.06); color: var(--text); border-color: rgba(255,255,255,.15); }
.btn-full  { width: 100%; justify-content: center; }
.btn-sm    { padding: .3rem .7rem; font-size: .8rem; }
.btn-xs    { padding: .18rem .5rem; font-size: .75rem; }

/* ─── Formulários ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  color: var(--text2);
  margin-bottom: .35rem;
  font-weight: 500;
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=number], input[type=url], select, textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .5rem .75rem;
  transition: border-color var(--trans), box-shadow var(--trans);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.1);
}
input::placeholder, textarea::placeholder { color: var(--text2); opacity: .55; }
select option { background: var(--card); }
textarea { resize: vertical; min-height: 80px; }
.input-eye { position: relative; }
.input-eye input { padding-right: 2.6rem; }
.input-eye button {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: .25rem;
  transition: color var(--trans);
  line-height: 1;
}
.input-eye button:hover { color: var(--text); }
.filter-card { padding: 1rem; margin-bottom: 1rem; }
.filter-form { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.filter-form input, .filter-form select { flex: 1; min-width: 130px; max-width: 200px; }
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
}
.inline-form input, .inline-form select { flex: 1; min-width: 150px; }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .4rem;
}
.checkbox-grid label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  color: var(--text);
  font-size: .875rem;
}
.plan-info {
  background: rgba(63,185,80,.08);
  border: 1px solid rgba(63,185,80,.25);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .85rem;
  color: var(--green);
  margin-bottom: 1rem;
}

/* ─── Alertas / Notificações ──────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
}
.alert-success { background: rgba(63,185,80,.1);  border: 1px solid rgba(63,185,80,.3);  color: var(--green); }
.alert-danger  { background: rgba(248,81,73,.1);  border: 1px solid rgba(248,81,73,.3);  color: var(--red); }
.alert-warning { background: rgba(210,153,34,.1); border: 1px solid rgba(210,153,34,.3); color: var(--yellow); }

/* ─── Alert Cards (alerts.php) ───────────────────────────────────────────────── */
.alerts-container { display: flex; flex-direction: column; gap: .75rem; }
.alert-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--border);
  transition: border-color var(--trans), box-shadow var(--trans);
}
.alert-card:hover { box-shadow: var(--shadow-sm); }
.alert-card.sev-low      { border-left-color: var(--green); }
.alert-card.sev-medium   { border-left-color: var(--yellow); }
.alert-card.sev-high     { border-left-color: var(--red); }
.alert-card.sev-critical { border-left-color: #ff6e6e; background: rgba(248,81,73,.04); }
.alert-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .5rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.alert-card-title { display: flex; align-items: center; gap: .5rem; font-size: .875rem; flex-wrap: wrap; }
.alert-card-meta  { display: flex; align-items: center; gap: .65rem; font-size: .82rem; color: var(--text2); flex-wrap: wrap; }
.alert-card-desc  { font-size: .84rem; color: var(--text2); margin: .3rem 0; }
.alert-card-rule  { font-size: .8rem; color: var(--text2); margin: .2rem 0; }
.alert-card-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.alert-status-badge {
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.alert-status-badge.open         { background: rgba(248,81,73,.15);  color: var(--red); }
.alert-status-badge.acknowledged { background: rgba(210,153,34,.15); color: var(--yellow); }
.alert-status-badge.resolved     { background: rgba(63,185,80,.15);  color: var(--green); }

/* ─── Alert toolbar ──────────────────────────────────────────────────────────── */
.alert-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.alert-list { padding: 0; }
.alert-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
}
.alert-item:hover { background: rgba(255,255,255,.02); }
.alert-item:last-child { border-bottom: none; }
.alert-item-body { flex: 1; min-width: 0; }
.alert-item-body strong { display: block; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-item-body span { font-size: .78rem; color: var(--text2); }
.alert-item-status { font-size: .75rem; color: var(--text2); white-space: nowrap; }

/* ─── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tab {
  padding: .5rem 1rem;
  color: var(--text2);
  font-size: .84rem;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all var(--trans);
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; }
.tab.active {
  background: rgba(88,166,255,.08);
  color: var(--blue);
  border-bottom: 2px solid var(--blue);
  margin-bottom: -1px;
  font-weight: 500;
}

/* ─── Paginação ──────────────────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: .25rem; padding: 1rem; flex-wrap: wrap; }
.pagination a {
  padding: .3rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: .85rem;
  transition: all var(--trans);
}
.pagination a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.pagination a:hover { text-decoration: none; background: rgba(255,255,255,.06); color: var(--text); }

/* ─── Quota Bar ──────────────────────────────────────────────────────────────── */
/* CORREÇÃO: quota-card não pode ter padding pois contém card-header no dashboard */
.quota-card { margin-bottom: 1rem; }

/* Header interno do quota card (usado em api-keys.php) */
.quota-header {
  padding: .7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .85rem;
}
/* Barra de progresso – inset horizontal para dar respiro visual */
.quota-bar {
  height: 6px;
  background: rgba(255,255,255,.08);
  border-radius: 3px;
  overflow: hidden;
  margin: .6rem 1.25rem;
}
.quota-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width .6s ease;
}
.quota-fill.quota-warn   { background: var(--yellow); }
.quota-fill.quota-danger { background: var(--red); }
.quota-text { font-size: .8rem; color: var(--text2); padding: 0 1.25rem .85rem; }

/* ─── Toggle Button ──────────────────────────────────────────────────────────── */
.toggle-btn {
  padding: .22rem .65rem;
  border-radius: 4px;
  border: 1px solid;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans);
  letter-spacing: .05em;
}
.toggle-btn.on  { background: rgba(63,185,80,.12); color: var(--green); border-color: rgba(63,185,80,.35); }
.toggle-btn.on:hover  { background: rgba(63,185,80,.22); }
.toggle-btn.off { background: rgba(139,148,158,.08); color: var(--text2); border-color: var(--border); }
.toggle-btn.off:hover { background: rgba(139,148,158,.18); }

/* ─── Status Badges ──────────────────────────────────────────────────────────── */
.status-badge { font-size: .7rem; padding: 2px 8px; border-radius: 4px; font-weight: 700; letter-spacing: .04em; }
.status-badge.active   { background: rgba(63,185,80,.13); color: var(--green); }
.status-badge.inactive { background: rgba(139,148,158,.1); color: var(--text2); }
.badge-manual { background: rgba(88,166,255,.13); color: var(--blue); font-size: .7rem; padding: 1px 6px; border-radius: 4px; }
.badge-auto   { background: rgba(248,81,73,.13); color: var(--red); font-size: .7rem; padding: 1px 6px; border-radius: 4px; }
.badge-feed   { background: rgba(188,140,255,.13); color: var(--purple); font-size: .7rem; padding: 1px 6px; border-radius: 4px; }
.tag {
  background: rgba(255,255,255,.05);
  color: var(--text2);
  font-size: .75rem;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-block;
  margin: 1px;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .25rem; }

/* ─── Threat Report ──────────────────────────────────────────────────────────── */
.threat-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.threat-ip { font-size: 1.05rem; padding: .3rem .75rem; }
.risk-score-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 3px solid;
  flex-shrink: 0;
}
.risk-score-circle span { font-size: 1.5rem; line-height: 1; }
.risk-score-circle small { font-size: .58rem; opacity: .75; }
.risk-low      { border-color: var(--green);  color: var(--green); }
.risk-medium   { border-color: var(--yellow); color: var(--yellow); }
.risk-high     { border-color: var(--red);    color: var(--red); }
.risk-critical { border-color: #ff6e6e;       color: #ff6e6e; }
.threat-status { font-weight: 700; font-size: .9rem; }
.threat-status.blocked { color: var(--red); }
.threat-status.clear   { color: var(--green); }
.threat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 1.25rem; }
.threat-grid div { display: flex; flex-direction: column; gap: .25rem; }
.threat-grid strong { font-size: .7rem; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; }

/* ─── Auth ───────────────────────────────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 55%, rgba(88,166,255,.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(248,81,73,.05) 0%, transparent 50%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem 2rem;
  margin: 1rem;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo i {
  font-size: 2.75rem;
  color: var(--red);
  filter: drop-shadow(0 0 14px rgba(248,81,73,.4));
  display: block;
  margin-bottom: .35rem;
}
.auth-logo h1 { font-size: 1.5rem; margin-bottom: .2rem; font-weight: 700; letter-spacing: -.02em; }
.auth-logo p { color: var(--text2); font-size: .84rem; }
.auth-links {
  text-align: center;
  margin-top: 1.1rem;
  font-size: .84rem;
  color: var(--text2);
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.auth-secure { text-align: center; margin-top: .85rem; font-size: .75rem; color: var(--text2); }
.auth-secure i { color: var(--green); }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header button {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.3rem;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 4px;
  transition: all var(--trans);
  line-height: 1;
}
.modal-header button:hover { background: rgba(255,255,255,.08); color: var(--text); }
.detail-table { width: calc(100% - 2.5rem); border-collapse: collapse; margin: 1rem 1.25rem; }
.detail-table th, .detail-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border); font-size: .85rem; }
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: none; }
.detail-table th { color: var(--text2); width: 140px; font-weight: 500; }

/* ─── Misc ───────────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text2); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: .35; display: block; }
.empty-state h3 { margin-bottom: .5rem; color: var(--text); font-size: 1rem; }
.mini-bar {
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  overflow: hidden;
  width: 80px;
  display: inline-block;
  vertical-align: middle;
  margin-right: .35rem;
}
.mini-bar div { height: 100%; background: var(--blue); border-radius: 2px; }

/* CORREÇÃO: settings-grid — cards têm card-header, o padding deve estar no form */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.settings-grid .card { padding: 0; }
.settings-grid .card > form { padding: 1.25rem; }

.plan-info-box {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  border: 1px solid;
}
.plan-info-box.plan-free       { background: rgba(139,148,158,.08); border-color: var(--border); color: var(--text2); }
.plan-info-box.plan-pro        { background: rgba(88,166,255,.08);  border-color: rgba(88,166,255,.3); color: var(--blue); }
.plan-info-box.plan-enterprise { background: rgba(188,140,255,.08); border-color: rgba(188,140,255,.3); color: var(--purple); }
.plan-info-box.plan-starter    { background: rgba(63,185,80,.08);   border-color: rgba(63,185,80,.3); color: var(--green); }
.plan-info-box.plan-business   { background: rgba(219,109,40,.08);  border-color: rgba(219,109,40,.3); color: var(--orange); }

.webhook-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: .9rem 1.25rem;
  gap: 1rem;
  border-top: 1px solid var(--border);
}
.webhook-actions { display: flex; gap: .4rem; flex-shrink: 0; margin-top: .1rem; }
.upgrade-notice { padding: 1rem 1.25rem; color: var(--text2); }
.rule-fields {
  margin: .75rem 0;
  padding: .85rem 1rem;
  background: rgba(255,255,255,.025);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.clickable-ip { cursor: pointer; transition: color var(--trans); }
.clickable-ip:hover { color: var(--blue); }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ─── Docs ───────────────────────────────────────────────────────────────────── */
.docs-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.docs-nav { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.docs-nav ul { list-style: none; margin-top: .5rem; }
.docs-nav li a {
  display: block;
  padding: .35rem .75rem;
  color: var(--text2);
  border-radius: 4px;
  font-size: .84rem;
  transition: all var(--trans);
}
.docs-nav li a:hover { color: var(--text); background: rgba(255,255,255,.05); text-decoration: none; }
.endpoint { margin-bottom: 2rem; }
.endpoint-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.method-badge { font-size: .7rem; font-weight: 700; padding: .22rem .65rem; border-radius: 4px; letter-spacing: .05em; }
.method-get    { background: rgba(63,185,80,.15); color: var(--green); }
.method-post   { background: rgba(88,166,255,.15); color: var(--blue); }
.method-delete { background: rgba(248,81,73,.15);  color: var(--red); }
.endpoint-path { font-family: 'SF Mono', Consolas, monospace; font-size: .95rem; color: var(--text); }
.code-tabs { display: flex; gap: .25rem; margin-bottom: .5rem; }
.code-tab {
  padding: .2rem .65rem;
  font-size: .8rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text2);
  transition: all var(--trans);
}
.code-tab.active { background: rgba(88,166,255,.1); color: var(--blue); border-color: rgba(88,166,255,.3); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .charts-grid, .tables-grid { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .docs-nav { position: static; }
  .threat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar-user { display: none; }
  .topbar-clock { display: none; }
  .content-area { padding: 1rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .inline-form { flex-direction: column; }
  .threat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.5rem 1.25rem; }
}
