:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: .2px; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); display: inline-block;
  transition: background .3s;
}
.dot.ok { background: var(--ok); }
.dot.degraded { background: var(--warn); }
.dot.down { background: var(--err); }

.tag { color: var(--muted); font-size: 12px; }

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

input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
input[type="password"] { width: 220px; }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

main { max-width: 1080px; margin: 0 auto; padding: 24px; display: grid; gap: 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: -.3px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 600; }
.panel-actions { display: flex; gap: 8px; align-items: center; }
.panel-actions.right { justify-content: flex-end; margin-top: 10px; }

.btn {
  font: inherit; font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f2f4f7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.ghost { color: var(--muted); }
.btn.danger { color: var(--err); border-color: #f3c6c6; }
.btn.danger:hover { background: #fef2f2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:hover { background: #fafbfc; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid transparent;
}
.pill.active { color: var(--ok); background: #ecfdf3; border-color: #cdebd7; }
.pill.cooldown { color: var(--warn); background: #fff8eb; border-color: #f4e2bd; }
.pill.disabled { color: var(--err); background: #fef2f2; border-color: #f7d4d4; }
.pill.quota { color: var(--warn); background: #fff8eb; border-color: #f4e2bd; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 500; }

.code {
  margin: 0; padding: 14px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  overflow-x: auto; white-space: pre;
}

.empty { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: 12px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2328; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 50;
}
.toast.err { background: var(--err); }
