:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #647086;
  --line: #dce2ec;
  --primary: #1463ff;
  --primary-dark: #0d47bd;
  --danger: #b42318;
  --success: #087443;
  --warning: #a15c00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: #aab6c8;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar form {
  margin: 0;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 28px;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.page-head p,
.muted {
  color: var(--muted);
}

.alert {
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.alert.success {
  color: var(--success);
  border-color: #a8dbc3;
}

.alert.error {
  color: var(--danger);
  border-color: #f1b7b2;
}

.table-wrap,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.key {
  display: block;
  max-width: 360px;
  overflow-wrap: anywhere;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.pill,
.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.pill {
  background: #edf3ff;
  color: #174a9c;
}

.status.active {
  background: #e9f8f0;
  color: var(--success);
}

.status.expired {
  background: #fff2df;
  color: var(--warning);
}

.status.blocked {
  background: #fdebea;
  color: var(--danger);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions form {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
}

input[readonly] {
  background: #f1f4f8;
}

.form-actions {
  grid-column: 1 / -1;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.split .panel {
  padding: 18px;
}

.inline-form {
  display: flex;
  gap: 10px;
}

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

.login-box {
  width: min(420px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
}

.stack {
  display: grid;
  gap: 14px;
}

@media (max-width: 760px) {
  .topbar,
  .page-head,
  .actions,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 14px 16px;
  }

  .topbar nav,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar nav {
    flex-wrap: wrap;
  }
}
