:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --sidebar-bg: #1e293b;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --body-bg: #f1f5f9;
  --card-radius: 12px;
}

/* ── Layout ─────────────────────────────────────────── */
body {
  background: var(--body-bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: var(--topbar-h);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.sidebar-brand-icon {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  list-style: none;
  margin: 0;
}

.sidebar-nav li + li { margin-top: 2px; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-radius: 7px;
  color: rgba(255,255,255,.65);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 0.85rem; }

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: var(--accent);
  color: #fff;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.license-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.license-count {
  font-size: 0.82rem;
  color: rgba(255,255,255,.8);
  margin-bottom: 0.4rem;
}

.license-bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.15);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.license-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.btn-buy {
  display: block;
  text-align: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(37,99,235,.25);
  color: #93c5fd;
  text-decoration: none;
  border: 1px solid rgba(37,99,235,.4);
  transition: background 0.15s, color 0.15s;
}

.btn-buy:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Topbar ──────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1020;
  gap: 1rem;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.topbar-user .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-logout {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  color: #64748b;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-logout:hover { background: #f8fafc; color: #1e293b; }

.hamburger {
  display: none;
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

/* ── Main content ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: calc(var(--topbar-h) + 2rem);
  padding-bottom: 2.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Stat cards ──────────────────────────────────────── */
.stat-card {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  background: #fff;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card.total  { border-left: 4px solid var(--accent); }
.stat-card.used   { border-left: 4px solid #f59e0b; }
.stat-card.free   { border-left: 4px solid #22c55e; }

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.1;
}

.stat-sub { font-size: 0.78rem; color: #94a3b8; }

/* ── Content card ────────────────────────────────────── */
.content-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border: none;
}

.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.content-card-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.content-card-body { padding: 1.5rem; }

/* ── Table ───────────────────────────────────────────── */
.table { font-size: 0.875rem; }
.table thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  border-bottom: 1px solid #f1f5f9;
  padding: 0.65rem 1rem;
  background: #fff;
}
.table tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f8fafc;
  color: #475569;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }

.key-mono {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  color: #475569;
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* ── Badges ──────────────────────────────────────────── */
.badge-mac {
  background: #ede9fe;
  color: #7c3aed;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.badge-win {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.badge-other {
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

/* ── Action buttons ──────────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  text-decoration: none;
  transition: all 0.15s;
  font-size: 0.8rem;
}
.btn-icon:hover { background: #f8fafc; color: #1e293b; }
.btn-icon.danger:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-icon.copied { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }

/* ── Auth pages ──────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--body-bg);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 2.5rem;
}

.auth-logo {
  display: block;
  margin: 0 auto 1.75rem;
  height: 38px;
}

.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Status / error pages ────────────────────────────── */
.status-card {
  max-width: 480px;
  margin: 2rem auto;
  text-align: center;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  padding: 3rem 2rem;
}

.status-icon {
  font-size: 3rem;
  margin-bottom: 1.25rem;
}

.status-icon.warning { color: #f59e0b; }
.status-icon.danger  { color: #ef4444; }
.status-icon.info    { color: var(--accent); }
.status-icon.success { color: #22c55e; }

.status-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.status-text {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 1.75rem;
}

/* ── Form helpers ────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.instruction-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  color: #1e40af;
  margin-bottom: 1.25rem;
}

/* ── DataTables overrides ────────────────────────────── */
.dataTables_wrapper {
  overflow-x: auto;
  max-width: 100%;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  padding: 0.85rem 1.25rem 0;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding: 0.75rem 1.25rem;
}
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.875rem;
}
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  min-width: 70px;
}
.dataTables_wrapper .dataTables_length select:focus {
  box-shadow: none;
  border-color: var(--accent);
}
.dataTables_wrapper .dataTables_info { font-size: 0.8rem; color: #94a3b8; }
.dataTables_wrapper .paginate_button {
  border-radius: 6px !important;
  font-size: 0.8rem !important;
}
.dataTables_wrapper .paginate_button.current {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 16px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1025;
  }
  .sidebar-overlay.open { display: block; }

  .topbar { left: 0; }
  .hamburger { display: block; }
  .main-content {
    margin-left: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
