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

:root {
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  font-size: 28px;
  text-align: center;
  margin-bottom: 8px;
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--gray-800);
  margin-bottom: 24px;
}

/* ── Navbar ────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 10;
}

.navbar__brand { font-size: 16px; font-weight: 700; }
.navbar__right  { display: flex; align-items: center; gap: 12px; }
.nav-badge {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ── Main layout ───────────────────────────────────────────────────── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 700; }

/* ── Stats ─────────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.stat-card--green { border-left: 4px solid var(--green); }
.stat-card--red   { border-left: 4px solid var(--red); }

.stat-card__value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-card__label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ── Toolbar ───────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.input--search { max-width: 280px; }
.select--sm { width: 140px; }

/* ── Table ─────────────────────────────────────────────────────────── */
.table-wrapper {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.table th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-50); }

.table__empty {
  text-align: center;
  color: var(--gray-400);
  padding: 40px !important;
  font-size: 14px;
}

.table__key {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .05em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.badge--active   { background: var(--green-bg); color: var(--green); }
.badge--inactive { background: var(--red-bg);   color: var(--red); }

.actions { display: flex; gap: 6px; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 5px;
}

.input, .select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus, .select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

textarea.input { resize: vertical; }

.error-msg {
  background: var(--red-bg);
  border: 1px solid #fecaca;
  color: var(--red);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--full { width: 100%; margin-top: 4px; }
.btn--sm   { padding: 6px 12px; font-size: 12px; }

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

.btn--secondary { background: var(--gray-100); color: var(--gray-800); }
.btn--secondary:hover:not(:disabled) { background: var(--gray-200); }

.btn--danger  { background: var(--red-bg); color: var(--red); }
.btn--danger:hover { background: #fecaca; }

.btn--success { background: var(--green-bg); color: var(--green); }
.btn--success:hover { background: #bbf7d0; }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
}

.modal__box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── License result box ────────────────────────────────────────────── */
.license-result {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.license-result__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 8px;
}

.license-result__key {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.license-result__note {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 8px;
}

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  animation: fadeInUp .2s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
