:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #059669;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}
.topbar {
  background: #0f172a;
  color: #f8fafc;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-badge {
  background: var(--primary);
  color: #fff;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}
.pill-live { background: #065f46; color: #d1fae5; }
.pill-sandbox { background: #78350f; color: #fef3c7; }
.pill-off { background: #334155; color: #cbd5e1; }
.pill-err { background: #7f1d1d; color: #fee2e2; }
.container { max-width: 1240px; margin: 22px auto; padding: 0 20px 48px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
}
.tab:hover { background: #e2e8f0; color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 6px; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field label { font-size: 12px; font-weight: 600; color: #334155; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--primary);
}
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; margin: 6px 0 12px; }
.checkbox-row input { width: auto; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-secret { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.code-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 10px 0;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--surface-alt); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #e2e8f0; color: #475569; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 410px; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 420px;
  width: 100%;
  padding: 22px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}
.modal-box h3 { margin: 0 0 8px; font-size: 16px; }
.modal-box p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
