* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0b0d10;
  color: #e6e8eb;
  font-size: 14px;
  line-height: 1.5;
}
a { color: #6aa9ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px;
  background: #14171c;
  border-bottom: 1px solid #1f242b;
}
.brand { font-weight: 700; letter-spacing: 0.3px; }
.nav { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 12px; border-radius: 6px; color: #a8b0bb;
}
.nav-link:hover { background: #1f242b; text-decoration: none; }
.nav-link.active { background: #1f242b; color: #fff; }
.ranges { display: flex; gap: 4px; margin-left: auto; }
.range {
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
  background: #1f242b; color: #a8b0bb;
}
.range.active { background: #2a64d4; color: #fff; }
.logout button {
  background: transparent; border: 1px solid #2a3038; color: #a8b0bb;
  padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.logout button:hover { background: #1f242b; color: #fff; }

main { padding: 20px; max-width: 1280px; margin: 0 auto; }

/* KPIs */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: #14171c; border: 1px solid #1f242b; border-radius: 10px;
  padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: #8a93a0; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.kpi-sub { font-size: 12px; color: #8a93a0; margin-top: 2px; }

/* Cards */
.card {
  background: #14171c; border: 1px solid #1f242b; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px 0; font-size: 14px; color: #c8cfd9; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #1f242b; }
th { color: #8a93a0; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }
.small { font-size: 12px; }

/* Tags */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; margin-right: 6px;
}
.tag.human { background: #103a25; color: #5fdc9a; }
.tag.bot { background: #3a1010; color: #f08585; }

/* Top list */
.toplist { list-style: none; padding: 0; margin: 0; }
.toplist li {
  position: relative; padding: 6px 10px; border-bottom: 1px solid #1f242b;
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.toplist li:last-child { border-bottom: none; }
.toplist-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(42, 100, 212, 0.12); z-index: 0;
}
.toplist-label { position: relative; flex: 1; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist-count { position: relative; z-index: 1; font-variant-numeric: tabular-nums; color: #8a93a0; }

/* Chart */
.chart-legend { font-size: 12px; color: #8a93a0; margin-bottom: 8px; }
.chart-legend .dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 12px;
  vertical-align: middle;
}
.chart-legend .dot.pv { background: #2a64d4; }
.chart-legend .dot.cl { background: #5fdc9a; }
.chart-bars {
  display: flex; align-items: flex-end; gap: 2px; height: 140px;
  border-bottom: 1px solid #1f242b; padding-bottom: 2px;
}
.chart-col { display: flex; gap: 1px; flex: 1; height: 100%; align-items: flex-end; min-width: 4px; }
.chart-bar { flex: 1; min-height: 1px; }
.chart-bar.pv { background: #2a64d4; }
.chart-bar.cl { background: #5fdc9a; }
.chart-empty { color: #8a93a0; padding: 20px; text-align: center; }

.muted { color: #8a93a0; }
.link { color: #6aa9ff; cursor: pointer; }

/* Login */
.login-body {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  background: #0b0d10;
}
.login-card {
  background: #14171c; border: 1px solid #1f242b; border-radius: 12px;
  padding: 28px; width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 18px; }
.login-card p { margin: 0; }
.login-card input {
  background: #0b0d10; border: 1px solid #2a3038; color: #fff;
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.login-card button {
  background: #2a64d4; color: #fff; border: none; padding: 10px;
  border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px;
}
.login-card button:hover { background: #3478ec; }
.error {
  background: #3a1010; color: #f08585; padding: 8px 12px;
  border-radius: 6px; font-size: 13px;
}

@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .ranges { margin-left: 0; order: 5; flex-basis: 100%; }
}
