:root {
  --bg: #0c0e12;
  --surface: #141820;
  --surface2: #1a2030;
  --border: #2a3348;
  --text: #e8ecf4;
  --muted: #8b95a8;
  --accent: #6c9eff;
  --accent-dim: #4a7ad4;
  --success: #3dd68c;
  --radius: 12px;
  --font: 'DM Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.brand-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.75rem;
}

.sidebar nav a {
  display: block;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.sidebar nav a.active {
  background: var(--surface2);
  color: var(--accent);
}

.sidebar-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: auto;
}

.main {
  padding: 1.75rem 2rem;
  max-width: 1400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.filters h2,
.table-section h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  align-items: end;
}

.filter-grid label span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.filter-grid input,
.filter-grid select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #0a0e18;
}

.btn-primary:hover {
  background: #85b1ff;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.25rem 0;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-value {
  display: block;
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: 0.35rem;
  color: var(--accent);
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chart-card h3 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
  font-weight: 600;
}

.bar-list {
  list-style: none;
}

.bar-list li {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.bar-list .bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}

.bar-list .bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 4px;
}

.bar-list .count {
  text-align: right;
  color: var(--muted);
}

.table-section {
  margin-top: 0;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: var(--surface2);
}

td.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface2);
}

.badge.mobile { color: #7dd3fc; }
.badge.tablet { color: #c4b5fd; }
.badge.desktop { color: #86efac; }

.click-pill {
  font-weight: 700;
  color: var(--success);
}

.page-path {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.pagination button {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination button.active {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
}
