:root {
  --cf-orange: #F6821F;
  --acme-red: #B91C1C;
  --acme-yellow: #FDE68A;
  --dark: #1D1D1D;
  --grey: #6B7280;
  --bg: #F8FAFC;
  --border: #E2E8F0;
  --green: #16A34A;
  --red: #DC2626;
  --amber: #D97706;
}

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

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--dark);
}

/* ── topbar ───────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark);
  color: white;
  padding: 12px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
}

.brand-mark { width: 32px; height: 32px; flex-shrink: 0; }

.brand-text-wrap { display: flex; align-items: baseline; gap: 8px; }
.brand-primary { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.brand-divider { color: #555; }
.brand-secondary { font-size: 0.8rem; color: #bbb; }

.host-pill {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "SF Mono", Consolas, monospace;
}
.host-pill.via-cf { background: rgba(246,130,31,0.18); color: var(--cf-orange); }
.host-pill.direct { background: rgba(220,38,38,0.18); color: var(--red); }

/* ── content ──────────────────────────────────────────────────────────── */
.content { padding: 24px 32px 48px; max-width: 1200px; margin: 0 auto; }

.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.subtitle { color: var(--grey); font-size: 0.9rem; margin-top: 4px; }

/* ── stat cards ───────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.card.alert { border-color: rgba(220,38,38,0.35); background: rgba(220,38,38,0.03); }

.card-label { font-size: 0.75rem; color: var(--grey); text-transform: uppercase; letter-spacing: 0.03em; }
.card-value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; }
.card-sub { font-size: 0.75rem; color: var(--grey); margin-top: 2px; }

/* ── live log ─────────────────────────────────────────────────────────── */
.log-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.log-header { display: flex; align-items: center; justify-content: space-between; }
.log-header h2 { font-size: 1.1rem; font-weight: 700; }

.log-controls { display: flex; align-items: center; gap: 10px; }
.log-status { font-size: 0.8rem; color: var(--grey); display: flex; align-items: center; gap: 6px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--green); box-shadow: 0 0 0 0 rgba(22,163,74,0.6); animation: pulse 1.5s infinite; }
.dot-paused { background: var(--grey); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--dark);
}
.btn-secondary:hover { background: var(--bg); }
.btn-small { padding: 4px 10px; }

.log-note { font-size: 0.8rem; color: var(--grey); margin: 10px 0 14px; max-width: 900px; }

.log-table-wrap { max-height: 480px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }

.log-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.log-table thead th {
  position: sticky;
  top: 0;
  background: #F1F5F9;
  text-align: left;
  padding: 8px 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--grey);
  border-bottom: 1px solid var(--border);
}
.log-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #F1F5F9;
  font-family: "SF Mono", Consolas, monospace;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-table tr.row-attack { background: rgba(220,38,38,0.06); }
.log-table tr.row-attack td { color: #7f1d1d; }
.log-empty { text-align: center; color: var(--grey); font-family: inherit; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-attack { background: var(--red); color: white; }
.badge-clean { background: #E2E8F0; color: var(--grey); }
.badge-bot-human { background: rgba(22,163,74,0.15); color: var(--green); }
.badge-bot-bot { background: rgba(220,38,38,0.15); color: var(--red); }
.badge-bot-na { background: #E2E8F0; color: var(--grey); }
.badge-verified { background: rgba(37,99,235,0.15); color: #2563EB; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
