:root {
  --bg: #0b111a;
  --bg-soft: #111a26;
  --card: #131e2b;
  --card-2: #172435;
  --line: #22334a;
  --text: #e6edf6;
  --muted: #8ba0b8;
  --accent: #22d3ee;
  --accent-2: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #12283b 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 0%, #102a2a 0%, transparent 55%), var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { max-width: 1240px; margin: 0 auto; padding: 22px 22px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 2px 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #22d3ee, #2dd4bf 60%, #a7f3d0);
  color: #04232b; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 6px 20px rgba(34, 211, 238, .28);
}
.brand h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; padding: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 20px; overflow-x: auto; }
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 9px 16px; border-radius: 10px;
  cursor: pointer; white-space: nowrap; transition: .18s;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tab.active { color: #062130; background: linear-gradient(135deg, #22d3ee, #34d399); font-weight: 650; }

.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) { .grid.two { grid-template-columns: 1fr; } }

.card { background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }

.stat { background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; letter-spacing: .4px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.value.good { color: var(--accent-2); }
.value.warn { color: var(--warn); }
.value.bad { color: var(--danger); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid rgba(34, 51, 74, .65); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .4px; white-space: nowrap; }
tbody tr:hover { background: rgba(34, 211, 238, .04); }
td.mono, .mono { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
td .muted, .muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 26px 0; }

.btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; transition: .16s; white-space: nowrap;
}
.btn:hover { border-color: #3b566f; background: rgba(255,255,255,.06); }
.btn.primary { background: linear-gradient(135deg, #22d3ee, #34d399); color: #04232b; border: 0; font-weight: 650; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: #fca5a5; border-color: #5b2430; background: rgba(248, 113, 113, .08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.ok { color: #6ee7b7; background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .28); }
.badge.err { color: #fca5a5; background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .28); }
.badge.warn { color: #fcd34d; background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .28); }
.badge.off { color: #94a3b8; background: rgba(148, 163, 184, .1); border-color: rgba(148, 163, 184, .26); }
.badge.info { color: #67e8f9; background: rgba(34, 211, 238, .1); border-color: rgba(34, 211, 238, .26); }

.token { font-family: Consolas, monospace; font-size: 12px; background: rgba(0,0,0,.35); border: 1px dashed var(--line); padding: 6px 9px; border-radius: 8px; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; overflow: hidden; }
.token span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input, select, textarea {
  width: 100%; background: #0d1722; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; outline: none; transition: .16s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .12); }
textarea { min-height: 84px; resize: vertical; font-family: Consolas, monospace; font-size: 12.5px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.form-row .help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.modal-mask { position: fixed; inset: 0; background: rgba(4, 9, 15, .72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 60; }
.modal { width: min(680px, 96vw); max-height: 90vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast-wrap { position: fixed; right: 20px; top: 20px; display: grid; gap: 8px; z-index: 90; }
.toast { background: #10202f; border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: slide .2s ease; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--accent-2); }
@keyframes slide { from { transform: translateX(12px); opacity: 0; } }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 94vw); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.login-card .logo { margin: 0 auto 14px; width: 46px; height: 46px; }
.login-card h2 { text-align: center; margin: 0 0 4px; font-size: 19px; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 12.5px; }

.foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 26px; }

.log-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(34,51,74,.55); font-size: 13px; }
.log-item:last-child { border-bottom: 0; }
.log-item .time { color: var(--muted); white-space: nowrap; font-family: Consolas, monospace; font-size: 12px; }
.log-item .msg { flex: 1; }
.log-item.warn .msg { color: #fcd34d; }
.log-item.error .msg { color: #fca5a5; }

.hint { background: rgba(34, 211, 238, .06); border: 1px solid rgba(34, 211, 238, .18); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; color: #b7dbe7; }
.hint code { background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 5px; font-family: Consolas, monospace; }
