:root {
  --bg: #0b1020;
  --bg-elev: #121a2f;
  --bg-card: #171f35;
  --bg-soft: #1d2742;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8edf8;
  --muted: #93a0bb;
  --accent: #4ea1ff;
  --accent-2: #3ee0b4;
  --danger: #ff6b7a;
  --warn: #f5c14a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(78, 161, 255, 0.16), transparent 50%),
    radial-gradient(800px 500px at 100% 0%, rgba(62, 224, 180, 0.1), transparent 45%),
    var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041018; font-weight: 800; font-size: 18px;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.02em; }
.sub { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.6; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 16px; }
input, select, textarea {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(78, 161, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.15);
}
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px;
  background: var(--bg-soft); color: var(--text);
  transition: 0.15s transform, 0.15s filter;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #4ea1ff, #3b82f6);
  color: #041018; font-weight: 650; width: 100%; padding: 12px;
}
.btn-accent { background: var(--accent-2); color: #062018; font-weight: 650; }
.btn-danger { background: rgba(255, 107, 122, 0.15); color: var(--danger); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.hint { color: var(--danger); min-height: 20px; font-size: 13px; margin: 8px 0 0; }

/* App shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; backdrop-filter: blur(16px);
  background: rgba(11, 16, 32, 0.82); z-index: 10;
}
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 18px; }
.user-chip { color: var(--muted); font-size: 13px; margin-right: 6px; }
.page { width: min(1280px, calc(100% - 32px)); margin: 24px auto 48px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar p { margin: 0; color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-head h3 { margin: 0 0 4px; font-size: 17px; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.6; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--muted); white-space: nowrap;
}
.status.ok { color: var(--accent-2); background: rgba(62, 224, 180, 0.1); }
.status.bad { color: var(--danger); background: rgba(255, 107, 122, 0.1); }
.status.ok::before, .status.bad::before, .status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.status.ok::before { box-shadow: 0 0 0 4px rgba(62, 224, 180, 0.15); }
.card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.card-actions .btn { padding: 8px 12px; }
.metrics { margin-top: 16px; display: grid; gap: 10px; }
.metric-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s ease; }
.bar.warn > span { background: linear-gradient(90deg, var(--warn), #ff8a4a); }
.bar.danger > span { background: linear-gradient(90deg, #ff8a4a, var(--danger)); }
.disks, .nets { display: grid; gap: 8px; }
.kv { font-size: 12px; color: var(--muted); }
.empty {
  grid-column: 1 / -1;
  text-align: center; color: var(--muted);
  padding: 64px 20px; border: 1px dashed var(--line); border-radius: var(--radius);
}

/* Modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 8, 18, 0.72);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  width: min(560px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal .sub { margin-bottom: 18px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.auth-pane { margin-top: 4px; }
.key-list { display: grid; gap: 8px; margin: 12px 0 16px; }
.key-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft);
}
.key-item .fp { color: var(--muted); font-size: 11px; word-break: break-all; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow);
  max-width: 360px; color: var(--text);
}
.toast.error { border-color: rgba(255,107,122,0.4); }
@media (max-width: 640px) {
  .row-2 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; }
}
