:root {
  --bg: #0f1216;
  --panel: #161b22;
  --panel-2: #1c232c;
  --border: #2a3340;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4f9cf9;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--err); min-height: 18px; font-size: 13px; }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #07121f; font-weight: 600; }
button.danger:hover { border-color: var(--err); color: var(--err); }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
input:focus { border-color: var(--accent); }

.login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2534, var(--bg));
}
.login-card {
  width: 320px; display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px;
}
.login-card h1 { margin: 0; font-size: 26px; letter-spacing: 1px; }
.login-card p { margin: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #2f81f7, #16b8a6);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #06121f;
}
.title { font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }

main { max-width: 1100px; margin: 0 auto; padding: 22px; display: flex; flex-direction: column; gap: 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card .value { font-size: 22px; font-weight: 650; }
.bar { height: 6px; border-radius: 4px; background: var(--panel-2); margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s; }
.bar.warn > div { background: var(--warn); }
.bar.err > div { background: var(--err); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 15px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(79, 156, 249, .05); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px rgba(63, 185, 80, .7); }
.dot.err { background: var(--err); }
.dot.warn { background: var(--warn); }
.dot.idle { background: var(--muted); }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-cell button { padding: 4px 10px; font-size: 12px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.drawer { position: fixed; inset: 0; z-index: 10; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.drawer-body {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 94vw);
  background: var(--bg); border-left: 1px solid var(--border); padding: 18px; overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-head h2 { margin: 0; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 12px 0 18px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

pre.logs {
  background: #0a0d11; border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap;
  max-height: 420px; overflow-y: auto; color: #c9d4e0;
}

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20; background: rgba(0,0,0,.55); }
.modal-card { width: min(460px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.modal-card h2 { margin: 0 0 14px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 18px; font-size: 13px; z-index: 30; max-width: 80vw;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--err); }

.section-title { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.tag { display: inline-block; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 11px; color: var(--muted); margin-right: 6px; }
