:root {
  --bg-primary: #06060a;
  --bg-secondary: #0d0d14;
  --bg-card: rgba(18, 18, 30, 0.85);
  --bg-card-hover: rgba(24, 24, 40, 0.9);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #e4e4e8;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent-blue: #00d4ff;
  --accent-purple: #7c3aed;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-orange: #f97316;
  --gradient-primary: linear-gradient(135deg, #00d4ff, #7c3aed);
  --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.main { flex: 1; margin-left: 260px; padding: 32px; }

/* ── Sidebar ───────────────────────────────────────── */
.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo h1 {
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-logo span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}
.sidebar-nav { flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}
.nav-item.active {
  color: var(--accent-blue);
  background: rgba(0, 212, 255, 0.05);
  border-left-color: var(--accent-blue);
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Page Header ───────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
}
.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ── Stat Cards ────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s;
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-value.green { background: var(--gradient-success); -webkit-background-clip: text; }
.stat-value.red { background: var(--gradient-danger); -webkit-background-clip: text; }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Tables ────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-free { background: rgba(136, 136, 160, 0.15); color: #8888a0; }
.badge-pro { background: rgba(0, 212, 255, 0.12); color: #00d4ff; }
.badge-enterprise { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.badge-active { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.badge-expired { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.badge-suspended { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--gradient-primary);
  color: white;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
.btn-danger {
  background: var(--gradient-danger);
  color: white;
}
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus {
  border-color: var(--accent-blue);
}
select { cursor: pointer; }
select option { background: var(--bg-secondary); }

/* ── Toolbar ───────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar input[type="text"] {
  max-width: 300px;
}
.toolbar select {
  max-width: 160px;
}

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── Activity Timeline ─────────────────────────────── */
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}
.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  margin-top: 6px;
  flex-shrink: 0;
}
.timeline-dot.activate { background: var(--accent-green); }
.timeline-dot.deny { background: var(--accent-red); }
.timeline-dot.suspend { background: var(--accent-yellow); }
.timeline-time {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* ── Login Page ────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.login-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 8px;
}
.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.88rem;
}
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--accent-red);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; overflow: hidden; }
  .sidebar-logo h1, .sidebar-logo span, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 14px; border-left: 0; }
  .main { margin-left: 60px; padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Copy to clipboard ────────────────────────────── */
.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.copy-btn:hover { color: var(--accent-blue); }

/* ── Key display ──────────────────────────────────── */
.license-key {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: var(--accent-blue);
  cursor: pointer;
}
.license-key:hover { text-decoration: underline; }

/* ── Plan distribution mini chart ─────────────────── */
.plan-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.plan-bar-segment { transition: width 0.5s ease; }
.plan-bar-free { background: #8888a0; }
.plan-bar-pro { background: #00d4ff; }
.plan-bar-enterprise { background: #7c3aed; }
.plan-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.plan-legend span::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.plan-legend .free::before { background: #8888a0; }
.plan-legend .pro::before { background: #00d4ff; }
.plan-legend .ent::before { background: #7c3aed; }

/* ── Donut chart placeholder ──────────────────────── */
.donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
