:root {
  --bg: #05070c;
  --bg-2: #080d16;
  --card: #0d121c;
  --card-2: #111825;
  --line: #1f2c3d;
  --line-soft: #182232;
  --text: #f4f8ff;
  --muted: #9aa9bd;
  --placeholder: #6c7b90;
  --blue: #1e88ff;
  --blue-deep: #0066ff;
  --blue-glow: #4da6ff;
  --chrome: #b7c4d0;
  --green: #34d399;
  --red: #fb7185;
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------ logo -- */
.logo-stack {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.bk-logo {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 18px rgba(0, 102, 255, .38));
  user-select: none;
}
.logo-reflection {
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  transform: scaleY(-1);
  opacity: .22;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 68%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 68%);
  filter: blur(.4px);
  pointer-events: none;
}

/* ----------------------------------------------------------------- login -- */
body.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 46%, #0b1626 0%, var(--bg) 58%, var(--bg) 100%);
}

.login-card {
  width: 470px;
  max-width: calc(100vw - 32px);
  padding: 46px 42px 38px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #101722 0%, var(--card) 100%);
  border: 1px solid rgba(30, 136, 255, .18);
  box-shadow: 0 0 0 1px rgba(255,255,255,.02), 0 0 70px rgba(0, 102, 255, .13);
  text-align: center;
}
.login-card .logo-stack {
  width: 310px;
  margin: 0 auto 52px;
}

.field { text-align: left; margin-bottom: 20px; }
.field label {
  display: block;
  margin: 0 0 8px 4px;
  color: #c3cede;
  font-size: 13px;
  font-weight: 600;
}
.input {
  width: 100%;
  height: 50px;
  padding: 0 17px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input::placeholder { color: var(--placeholder); }
.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30, 136, 255, .18);
}

.primary-btn {
  width: 100%;
  height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  font-weight: 700;
  letter-spacing: .3px;
  background: linear-gradient(180deg, #2b9bff 0%, var(--blue) 50%, var(--blue-deep) 100%);
  box-shadow: 0 10px 30px rgba(0, 102, 255, .32), inset 0 1px 0 rgba(255,255,255,.3);
  transition: filter .16s, transform .16s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn .arrow { float: right; font-size: 19px; line-height: 18px; }

.form-error {
  min-height: 18px;
  margin-top: 14px;
  color: var(--red);
  font-size: 12px;
}

/* ------------------------------------------------------------------- app -- */
body.app-page { background: #07090e; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 238px;
  flex: 0 0 238px;
  padding: 28px 18px 20px;
  background: #070a11;
  border-right: 1px solid #18202d;
  display: flex;
  flex-direction: column;
}
.sidebar .logo-stack { width: 158px; margin: 0 0 12px 8px; }
.sidebar .logo-reflection { display: none; }
.side-label {
  margin: 34px 12px 10px;
  color: #5f6f85;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}
.nav-item {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 5px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #b3bfd0;
  text-align: left;
  font-weight: 600;
}
.nav-item:hover { background: #101824; color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(30,136,255,.22), rgba(30,136,255,.035));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-bottom { margin-top: auto; display: grid; gap: 8px; }
.discord-link {
  padding: 10px 12px;
  color: var(--blue-glow);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
}
.ghost-btn {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #223046;
  background: #101724;
  color: #c4cedd;
  font-weight: 600;
}
.ghost-btn:hover { border-color: var(--blue); color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 34px 50px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  color: #d6e0ed;
  font-weight: 600;
}
.topbar .account-chip {
  padding: 8px 13px;
  border: 1px solid #223046;
  border-radius: 999px;
  color: var(--blue-glow);
  font-size: 12px;
  background: #0e1624;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 34px 40px;
  border-radius: 22px;
  border: 1px solid #1b2b42;
  background:
    radial-gradient(circle at 82% 45%, rgba(30,136,255,.32), transparent 44%),
    linear-gradient(100deg, #080c14 0%, #0c1523 62%, #0b1a2c 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hero h1 { margin: 0 0 8px; font-size: 31px; letter-spacing: -.5px; }
.hero p { margin: 0; color: #aebbd0; font-size: 14px; }
.hero .logo-stack { width: 340px; margin-right: 18px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.stat-card {
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid #1a2535;
  background: linear-gradient(180deg, #101825, #0c121c);
}
.stat-card .label { color: #8d9db2; font-size: 12px; }
.stat-card .value { margin-top: 8px; font-size: 30px; font-weight: 800; }

.panel {
  border-radius: 18px;
  border: 1px solid #1a2535;
  background: #0c1119;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 14px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.btn-primary {
  padding: 10px 18px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, #2b9bff, var(--blue-deep));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 102, 255, .25);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.filters {
  display: flex;
  gap: 10px;
  padding: 0 22px 18px;
}
.filters .input, .filters select { height: 40px; border-radius: 11px; }
.filters .search { flex: 1; }
.filters select { width: 170px; padding: 0 12px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); }
.filters .ghost-btn { width: auto; padding: 0 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 14px 16px;
  text-align: left;
  border-top: 1px solid #182231;
  white-space: nowrap;
}
th { color: #7c8ba0; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }
td { color: #dce5f1; }
.license-cell { font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.license-note { margin-top: 4px; color: #7c8ba0; font-family: inherit; font-size: 11px; font-weight: 400; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active { color: var(--green); background: rgba(52,211,153,.1); }
.pill.unused { color: var(--blue-glow); background: rgba(30,136,255,.13); }
.pill.revoked { color: var(--red); background: rgba(251,113,133,.1); }
.pill.frozen { color: #93c5fd; background: rgba(147,197,253,.12); }
.actions { display: flex; gap: 6px; }
.action-btn {
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid #26364b;
  background: #141d2a;
  color: #b9c6d8;
  font-size: 11px;
}
.action-btn:hover { border-color: var(--blue); color: #fff; }
.action-btn.danger:hover { border-color: var(--red); color: #fecdd3; }

.empty { padding: 40px; text-align: center; color: #6f7e93; }

/* ----------------------------------------------------------------- modal -- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(3, 5, 9, .74);
  backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid rgba(30,136,255,.28);
  background: var(--card);
  box-shadow: 0 0 70px rgba(0, 102, 255, .18);
}
.modal-card h3 { margin: 0 0 20px; font-size: 19px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; color: #c3cede; }
.check-row input { width: 17px; height: 17px; accent-color: var(--blue); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.modal-actions .btn-primary { width: auto; min-width: 120px; }
.key-results {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.key-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-family: ui-monospace, Consolas, monospace;
  color: #8cc6ff;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: 420px;
  padding: 13px 18px;
  border-radius: 12px;
  border: 1px solid #24374f;
  background: #111b29;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.toast[hidden] { display: none; }
.toast.error { border-color: #7f1d1d; color: #fecdd3; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .sidebar { width: 190px; flex-basis: 190px; }
  .main { padding: 20px; }
  .stats { grid-template-columns: 1fr; }
  .hero .logo-stack { display: none; }
}
