:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232734;
  --border: #2a2e3a;
  --text: #e1e4eb;
  --text2: #8b8fa3;
  --primary: #6366f1;
  --primary-hover: #4f52d6;
  --accent: #22d3ee;
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 2px;
}

.tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--primary);
  color: #fff;
}

/* Select */
.select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  min-width: 130px;
}

.select:focus { border-color: var(--primary); }

/* Button */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:hover { background: var(--border); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

/* Main */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-label {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

/* Sections */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Per-App */
.per-app-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.per-app-item {
  background: var(--surface2);
  padding: 12px 18px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.per-app-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.per-app-name {
  font-size: 14px;
  font-weight: 500;
}

.per-app-count {
  font-size: 14px;
  color: var(--text2);
}

/* Charts */
.chart-wrapper {
  position: relative;
  max-height: 300px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}

/* Table */
.table-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.table-info {
  font-size: 13px;
  color: var(--text2);
  margin-left: auto;
}

.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table tbody tr:hover { background: var(--surface2); }

.table .empty {
  text-align: center;
  color: var(--text2);
  padding: 40px;
}

.params-cell {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text2);
  max-width: 300px;
  white-space: pre-wrap;
  word-break: break-all;
}

.badge {
  background: var(--surface2);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
}

#pageInfo {
  font-size: 14px;
  color: var(--text2);
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text2);
  font-size: 13px;
}
