:root {
  --bg: #000000;
  --panel: #0d0d0d;
  --panel-border: #1f1f1f;
  --input-bg: #000000;
  --text: #e8e9ed;
  --text-dim: #8b8f9c;
  --accent: #3b82f6;
  --accent-dim: #1e3a63;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(59, 130, 246, 0.13), transparent 52%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(180deg, #050505, #000000);
}

header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
}

header .brand .badge {
  font-size: 11px;
  font-weight: 700;
  color: #f97316;
  border: 1px solid #7c2d12;
  background: #1a0f08;
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 6px;
}

.btn-logout {
  background: #181a22;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn-logout:hover { color: var(--text); border-color: #3a3e4a; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.tab-panel {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 24px;
}

@media (max-width: 860px) {
  .tab-panel { grid-template-columns: 1fr; }
}

.tabs {
  display: flex;
  gap: 4px;
  max-width: 1100px;
  margin: 24px auto 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--panel-border);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 7px;
}

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

.tab-btn.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--panel-border);
  vertical-align: middle;
}

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

.empty-state {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 30px 0;
}

.search-bar {
  width: 100%;
  margin-bottom: 18px;
}

.btn-small {
  background: #181a22;
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-small:hover { border-color: #3a3e4a; }
.btn-small.danger { color: var(--danger); }
.btn-small.success { color: var(--success); }

.assign-input {
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.assign-input:focus { outline: none; border-color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 24px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  margin-top: 18px;
}
label:first-of-type { margin-top: 0; }

input[type="text"], select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

button.primary {
  width: 100%;
  margin-top: 22px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s;
}
button.primary:hover { filter: brightness(1.1); }
button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.footer-note {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

.key-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
  font-size: 13px;
}
.key-row:last-child { border-bottom: none; }

.key-code {
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--accent);
  font-weight: 600;
}

.key-meta { color: var(--text-dim); font-size: 12px; }

.tag {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.tag.unused { background: #10241a; color: var(--success); }
.tag.used { background: #241a10; color: #f59e0b; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}
.btn-icon:hover { color: var(--danger); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(160deg, #121722, var(--panel) 65%);
  border: 1px solid #252d3c;
  border-radius: 18px;
  padding: 36px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}
.login-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 30px;
  line-height: 1.5;
}
.login-card label {
  color: #c4cad6;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  margin: 0 0 9px;
}
.login-card input[type="password"] {
  width: 100%;
  min-height: 46px;
  background: #090c12;
  border: 1px solid #2a3140;
  border-radius: 9px;
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}
.login-card button.primary {
  min-height: 46px;
  margin-top: 18px;
  border-radius: 9px;
}
.login-card button.primary:disabled {
  opacity: 0.65;
  cursor: wait;
}
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  min-height: 18px;
}

@media (max-width: 480px) {
  .login-card { padding: 28px 22px; }
}
