:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ea580c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}

.auth-container {
  max-width: 420px;
  margin: 8vh auto;
  padding: 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

h1 { font-size: 24px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-bottom: 12px; }
.subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
input, textarea, select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  transition: border-color .15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { min-height: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; resize: vertical; }

button, .btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: var(--primary);
  color: white;
  text-decoration: none;
  transition: background .15s;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #475569; }
.btn-secondary:hover { background: #334155; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 24px;
}
.navbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navbar-brand { font-weight: 600; font-size: 16px; }
.navbar-user { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--text-muted); }

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { font-weight: 600; font-size: 13px; color: var(--text-muted); background: #f8fafc; }
tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: #dcfce7; color: var(--success); }
.badge-warn { background: #ffedd5; color: var(--warning); }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }

.flex { display: flex; gap: 12px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

pre.json-view {
  background: #f1f5f9;
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.kv-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.kv-row input { margin: 0; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
