:root {
  --bg: #0f1117;
  --surface: #1a1d2e;
  --surface2: #232640;
  --border: #2e3254;
  --accent: #6c63ff;
  --accent2: #4ecdc4;
  --safe: #22c55e;
  --risky: #f59e0b;
  --invalid: #ef4444;
  --text: #e2e8f0;
  --text-muted: #8892b0;
  --radius: 12px;
  --sidebar-w: 220px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
}

/* Layout */
.layout { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 99px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  margin: 2px 8px;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; }

.section { display: none; flex: 1; overflow-y: auto; padding: 24px 28px; }
.section.active { display: block; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  border-top: 3px solid var(--border);
}
.stat-total { border-top-color: var(--accent); }
.stat-safe { border-top-color: var(--safe); }
.stat-risky { border-top-color: var(--risky); }
.stat-invalid { border-top-color: var(--invalid); }
.stat-disposable { border-top-color: #a78bfa; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* Charts */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-muted); }

/* Toolbar */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }

/* Table */
.table-card { padding: 0; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 10px 14px; font-size: 13px; }
.loading-row { text-align: center; color: var(--text-muted); padding: 32px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-safe { background: rgba(34,197,94,.15); color: var(--safe); }
.badge-risky { background: rgba(245,158,11,.15); color: var(--risky); }
.badge-invalid { background: rgba(239,68,68,.15); color: var(--invalid); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 10px; padding: 12px 14px; justify-content: flex-end; }
#page-info { color: var(--text-muted); font-size: 12px; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #574fd6; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }
.btn-danger { background: var(--invalid); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Inputs */
.input, .select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  min-width: 160px;
}
.input:focus, .select:focus { border-color: var(--accent); }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 360px;
  width: 90%;
}
.modal-box p { margin-bottom: 20px; font-size: 15px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
