* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #17202a;
  background: #f3f6f8;
}

a {
  color: #1167b1;
  text-decoration: none;
}

code {
  font-family: Consolas, monospace;
  font-size: 12px;
}

.topbar {
  min-height: 60px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  background: #102030;
  color: #fff;
}

.brand {
  font-weight: 700;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}

.topbar a {
  color: #dce9f5;
  font-size: 14px;
}

.admin-user {
  color: #9fb7cc;
  font-size: 13px;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 26px auto;
}

h1 {
  margin: 0 0 18px;
  font-size: 26px;
}

h2 {
  margin: 0;
  font-size: 18px;
}

.panel,
.stat,
.login-card {
  background: #fff;
  border: 1px solid #dce4ea;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.panel-head,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-bottom: 4px;
}

.stat span,
.muted {
  color: #607080;
  font-size: 13px;
}

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

th,
td {
  border-bottom: 1px solid #e5ebef;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #4b5d6b;
  font-weight: 700;
}

label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 700;
  font-size: 13px;
}

input,
select,
textarea,
button,
.button {
  border-radius: 6px;
  border: 1px solid #cbd6df;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-block;
  width: auto;
  padding: 9px 14px;
  color: #fff;
  background: #1167b1;
  border-color: #1167b1;
  cursor: pointer;
}

.button.secondary {
  color: #17202a;
  background: #eef3f7;
  border-color: #cbd6df;
}

.filters {
  display: flex;
  gap: 10px;
  flex: 1;
}

.filters input {
  max-width: 360px;
}

.filters select {
  max-width: 170px;
}

.form-panel {
  max-width: 720px;
}

.inline-field,
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-field span {
  color: #607080;
  font-size: 12px;
  white-space: nowrap;
}

.inline-form select {
  width: 120px;
}

.inline-form button {
  padding: 7px 10px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e8edf2;
  color: #2d3a45;
}

.badge.active,
.badge.valid,
.badge.deactivated {
  background: #dff4e8;
  color: #17633a;
}

.badge.inactive,
.badge.expired,
.badge.device_mismatch,
.badge.activation_limit_reached {
  background: #fff1d6;
  color: #7a4a00;
}

.badge.banned,
.badge.revoked,
.badge.invalid_key,
.badge.server_error,
.badge.rate_limited {
  background: #fde2e2;
  color: #8a1f1f;
}

.alert {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: 6px;
  background: #dff4e8;
  color: #17633a;
}

.alert.error {
  background: #fde2e2;
  color: #8a1f1f;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  padding: 26px;
}

.login-card h1 {
  margin-bottom: 6px;
}

.login-card p {
  margin: 0 0 18px;
  color: #607080;
}

.login-card button {
  width: 100%;
  margin-top: 16px;
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .filters input,
  .filters select,
  .button {
    max-width: none;
    width: 100%;
  }
}
