* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #1f2937;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

a {
  color: #2563eb;
  text-decoration: none;
}

code {
  color: #111827;
  font-family: Consolas, Monaco, monospace;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar nav {
  display: flex;
  gap: 16px;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.narrow-page {
  max-width: 760px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stats div,
.panel,
.login-box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.stats div {
  padding: 18px;
}

.stats strong {
  display: block;
  font-size: 28px;
  line-height: 1.2;
}

.stats span {
  color: #6b7280;
}

.panel {
  margin-bottom: 20px;
  padding: 20px;
}

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

textarea,
input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.code-editor {
  min-height: 70vh;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}

button {
  margin-top: 12px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #ffffff;
  padding: 10px 18px;
  font: inherit;
  cursor: pointer;
}

.bulk-control,
.row-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 14px;
}

.bulk-control label {
  color: #4b5563;
  font-size: 14px;
}

.bulk-control input,
.row-actions input {
  width: 96px;
}

.bulk-control button,
.row-actions button {
  margin-top: 0;
  padding: 8px 12px;
  white-space: nowrap;
}

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

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

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 11px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #4b5563;
  font-weight: 600;
  background: #f9fafb;
}

.value-cell {
  max-width: 360px;
  white-space: normal;
  word-break: break-all;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.badge.used {
  background: #fee2e2;
  color: #991b1b;
}

.badge.muted {
  background: #fef3c7;
  color: #92400e;
}

.badge.reserved {
  background: #dbeafe;
  color: #1e40af;
}

.badge.unused {
  background: #dcfce7;
  color: #166534;
}

.badge.online {
  background: #dcfce7;
  color: #166534;
}

.badge.offline {
  background: #e5e7eb;
  color: #374151;
}

.badge.muted {
  background: #e5e7eb;
  color: #374151;
}

.subtext {
  color: #6b7280;
  font-size: 12px;
}

.action {
  font-size: 14px;
}

.danger {
  color: #b91c1c;
}

.empty {
  color: #6b7280;
  text-align: center;
}

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

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 24px;
}

.login-box h1 {
  margin: 0 0 18px;
  font-size: 24px;
}

.login-box label {
  display: block;
  margin: 12px 0 6px;
}

.alert {
  margin-bottom: 12px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 12px;
}

.notice {
  margin-bottom: 16px;
  border-radius: 6px;
  padding: 12px 14px;
}

.notice.success {
  background: #dcfce7;
  color: #166534;
}

.notice.error {
  background: #fee2e2;
  color: #991b1b;
}

.muted {
  color: #6b7280;
  line-height: 1.6;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.check-row input {
  width: auto;
}

.compact-list {
  margin: 8px 0 16px;
  padding-left: 20px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .bulk-control,
  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page {
    padding: 16px;
  }
}
