:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1a1a26;
  --border: #2a2a3a;
  --text: #e4e4ef;
  --text-dim: #8888a0;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --green: #00d68f;
  --red: #ff4757;
  --amber: #ffa502;
  --radius: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Login ──────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 400px;
  text-align: center;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 14px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--accent);
}

/* ── Header ─────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header .badge {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 20px;
  font-weight: 500;
}

.header button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.header button:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── Stats Grid ─────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-card .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
}

.stat-card .value.green {
  color: var(--green);
}

.stat-card .value.red {
  color: var(--red);
}

.stat-card .value.amber {
  color: var(--amber);
}

.stat-card .value.accent {
  color: var(--accent);
}

/* ── Tabs ────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

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

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Toolbar ─────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.filter-select {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

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

/* ── Table ────────────────────────────── */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: var(--accent-glow);
}

.code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
}

/* ── Badges ──────────────────────────── */
.badge-license {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-regular {
  background: rgba(0, 214, 143, 0.12);
  color: var(--green);
}

.badge-extended {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent);
}

.badge-blocked {
  background: rgba(255, 71, 87, 0.12);
  color: var(--red);
}

.badge-active {
  background: rgba(0, 214, 143, 0.12);
  color: var(--green);
}

/* ── Buttons ─────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(255, 71, 87, 0.1);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Actions Cell ────────────────────── */
.actions-cell {
  display: flex;
  gap: 4px;
}

/* ── Detail Drawer ───────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

.drawer {
  width: 420px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  height: 100vh;
  overflow-y: auto;
  animation: slideIn 0.25s ease;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h3 {
  font-size: 16px;
}

.drawer-body {
  padding: 20px 24px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 13px;
  text-align: right;
  word-break: break-all;
}

/* ── Toast ────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 400px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: var(--green);
  color: #000;
}

.toast-error {
  background: var(--red);
  color: #fff;
}

.toast-info {
  background: var(--accent);
  color: #fff;
}

/* ── Modal ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 90%;
}

/* ── Empty & Loading ─────────────────── */
.empty {
  text-align: center;
  padding: 48px;
  color: var(--text-dim);
}

.empty .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-dim);
}

/* ── Animations ──────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}