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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  min-height: 100vh;
}

a { color: #60a5fa; text-decoration: none; }
a:hover { color: #93c5fd; }

/* ─── Sidebar ──────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #161b27;
  border-right: 1px solid #1e2535;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 0 20px 24px;
  border-bottom: 1px solid #1e2535;
  margin-bottom: 12px;
}
.sidebar-brand h1 { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.sidebar-brand span { font-size: 11px; color: #64748b; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: #1e2535;
  color: #fff;
}
.sidebar-nav a .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid #1e2535;
}

/* ─── Main ────────────────────────────────────────────── */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
}

.page-header {
  margin-bottom: 28px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: #fff; }
.page-header p { color: #64748b; font-size: 13px; margin-top: 4px; }

/* ─── Cards ────────────────────────────────────────────── */
.card {
  background: #161b27;
  border: 1px solid #1e2535;
  border-radius: 12px;
  padding: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #161b27;
  border: 1px solid #1e2535;
  border-radius: 10px;
  padding: 20px;
}
.stat-card .stat-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: #fff; margin-top: 4px; }
.stat-card .stat-desc { font-size: 12px; color: #475569; margin-top: 4px; }

/* ─── Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #1e2535; }
table { width: 100%; border-collapse: collapse; background: #161b27; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  background: #0f1117;
  border-bottom: 1px solid #1e2535;
}
td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #1a2030;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #1a2030; }

/* ─── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-green { background: #14532d22; color: #4ade80; border: 1px solid #166534; }
.badge-red   { background: #7f1d1d22; color: #f87171; border: 1px solid #7f1d1d; }
.badge-yellow{ background: #78350f22; color: #fbbf24; border: 1px solid #78350f; }
.badge-gray  { background: #1e293b;   color: #94a3b8; border: 1px solid #334155; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary  { background: #2563eb; color: #fff; }
.btn-primary:hover  { background: #1d4ed8; color: #fff; }
.btn-success  { background: #16a34a; color: #fff; }
.btn-success:hover  { background: #15803d; color: #fff; }
.btn-warning  { background: #d97706; color: #fff; }
.btn-warning:hover  { background: #b45309; color: #fff; }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-danger:hover   { background: #b91c1c; color: #fff; }
.btn-ghost    { background: transparent; color: #94a3b8; border: 1px solid #334155; }
.btn-ghost:hover    { background: #1e2535; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #94a3b8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
  width: 100%;
  background: #0f1117;
  border: 1px solid #1e2535;
  border-radius: 8px;
  padding: 9px 13px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: #2563eb; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: #161b27;
  border: 1px solid #1e2535;
  border-radius: 14px;
  padding: 28px;
  width: 460px;
  max-width: 95vw;
}
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 20px; color: #fff; }

/* ─── Key box ────────────────────────────────────────────── */
.key-box {
  background: #0f1117;
  border: 1px solid #2563eb33;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #60a5fa;
  word-break: break-all;
  cursor: pointer;
}
.key-box:hover { border-color: #2563eb; }

/* ─── Alert ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #7f1d1d22; border: 1px solid #7f1d1d; color: #fca5a5; }
.alert-success { background: #14532d22; border: 1px solid #166534; color: #86efac; }

/* ─── Login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f1117;
}
.login-card {
  background: #161b27;
  border: 1px solid #1e2535;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
}
.login-card h1 { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.login-card p { color: #64748b; font-size: 13px; margin-bottom: 28px; }
