:root {
  --bg: #0d1015;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(90,169,255,.10), transparent 60%),
             radial-gradient(900px 500px at 100% 0%, rgba(61,220,132,.06), transparent 60%);
  --panel: #151a21;
  --panel-2: #1c232c;
  --border: #252d37;
  --border-hi: #35414f;
  --text: #e7eaef;
  --muted: #8a94a3;
  --dim: #667080;
  --accent: #6cb2ff;
  --up: #3ddc84;
  --down: #ff5f5f;
  --warn: #ffb547;
  --unknown: #6b7480;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background-color: var(--bg); background-image: var(--bg-grad); background-repeat: no-repeat; color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.dim { color: var(--dim); font-weight: 400; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; background: rgba(13,16,21,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .01em; }
.summary { color: var(--muted); font-size: 13px; }
.summary b { color: var(--text); font-weight: 600; }
.summary .up { color: var(--up); }
.summary .down { color: var(--down); }
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; align-items: center; gap: 4px; padding: 3px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; }
.chip { border: 0; background: transparent; color: var(--muted); padding: 4px 11px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-family: inherit; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-hi); }
.chip-sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; }
#search {
  width: 280px; max-width: 60vw; padding: 7px 12px; border-radius: 999px; font-family: inherit;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); outline: none;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,178,255,.15); }
.btn {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); font-family: inherit; font-size: 13px;
  background: var(--panel-2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: wait; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.primary { background: var(--accent); color: #0b1220; border-color: transparent; font-weight: 600; justify-content: center; }
.updated { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

main { padding: 18px 24px 40px; max-width: 1640px; margin: 0 auto; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 22px 0 12px; }

/* ---------- alerts ---------- */
.alerts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 10px 14px; border-radius: var(--radius);
  background: rgba(255,95,95,.08); border: 1px solid rgba(255,95,95,.3); }
.alerts-title { color: var(--down); font-weight: 600; margin-right: 4px; }
.alert-chip { color: var(--text); font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: rgba(255,95,95,.14); border: 1px solid rgba(255,95,95,.25); }
.alert-chip:hover { text-decoration: none; background: rgba(255,95,95,.24); }

/* ---------- servers ---------- */
.servers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr)); gap: 16px; }
.server { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.server.offline { border-color: rgba(255,95,95,.5); }
.server-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.server-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.server-head .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.server-head .links { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; white-space: nowrap; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 12px; }
.metric label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.metric label b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8cc8ff); border-radius: 3px; transition: width .5s ease; }
.bar.warn i { background: var(--warn); }
.bar.crit i { background: var(--down); }
.server-error { color: var(--down); font-size: 13px; }

details.guests-wrap > summary, details.stopped-wrap > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; user-select: none; padding: 6px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; margin-right: 6px; transition: transform .15s; color: var(--dim); }
details[open] > summary::before { transform: rotate(90deg); }
details.guests-wrap > summary b { color: var(--text); }
details.stopped-wrap { margin-top: 4px; }
.guests { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.guests th { text-align: left; color: var(--dim); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.guests td { padding: 5px 6px; border-bottom: 1px solid rgba(37,45,55,.6); white-space: nowrap; }
.guests tbody tr:hover td { background: rgba(255,255,255,.02); }
.guests tr.stopped td { color: var(--dim); }
.guests .num { text-align: right; font-variant-numeric: tabular-nums; }
.type { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; background: var(--panel-2); color: var(--muted); }

/* ---------- status dot ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); vertical-align: middle; margin-right: 7px; flex: none; }
.dot.up { background: var(--up); box-shadow: 0 0 0 3px rgba(61,220,132,.15); }
.dot.down { background: var(--down); box-shadow: 0 0 0 3px rgba(255,95,95,.18); }

/* ---------- projects ---------- */
.group { margin-bottom: 24px; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.group-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.group-head .count { font-size: 12px; color: var(--muted); }
.group-head .count.warn { color: var(--warn); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 5px; transition: border-color .15s, transform .15s, box-shadow .15s; outline: none;
}
.card[data-href] { cursor: pointer; }
.card:hover, .card:focus-visible { border-color: var(--border-hi); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.card.down { border-color: rgba(255,95,95,.45); background: linear-gradient(180deg, rgba(255,95,95,.05), transparent 40%) var(--panel); }
.card:target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,178,255,.2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-head .name { font-weight: 650; font-size: 15px; display: flex; align-items: center; min-width: 0; }
.card .latency { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card.down .latency { color: var(--down); }
.card .url { font-size: 15px; word-break: break-all; }
.card .url a { font-weight: 600; }
.card .url .arrow { font-size: 12px; margin-left: 4px; opacity: .6; }
.card .alt { font-size: 12px; color: var(--muted); word-break: break-all; }
.card .alt a { color: var(--muted); }
.card .internal { font-size: 12px; color: var(--dim); font-family: var(--mono); word-break: break-all; }
.card .internal a { color: var(--dim); }
.card .internal a:hover { color: var(--accent); }
.card-foot { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.host { color: var(--accent); border-color: rgba(108,178,255,.3); background: rgba(108,178,255,.08); }
.badge.running { color: var(--up); border-color: rgba(61,220,132,.3); background: rgba(61,220,132,.06); }
.badge.stopped { color: var(--down); border-color: rgba(255,95,95,.3); background: rgba(255,95,95,.06); }
.card .note { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-result::after { content: "没有匹配的项目"; display: block; color: var(--dim); text-align: center; padding: 30px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

.skeleton { height: 220px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }

.footer { text-align: center; color: var(--dim); font-size: 12px; padding: 16px 24px 32px; border-top: 1px solid var(--border); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: #2a1618; color: #ffb3b3; border: 1px solid rgba(255,95,95,.4); font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 20; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; }
.login-card { width: min(360px, 90vw); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 28px 26px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.login-card .brand { justify-content: center; margin-bottom: 4px; }
.login-hint { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.login-card input { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 16px; letter-spacing: .2em; text-align: center; outline: none; font-family: inherit; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,178,255,.15); }
.login-error { min-height: 18px; color: var(--down); font-size: 12.5px; text-align: center; }
.login-card .btn { padding: 10px; font-size: 14px; border-radius: 10px; }

@media (max-width: 760px) {
  .servers { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; gap: 8px; }
  .metric label .dim { display: none; }
  main { padding: 12px; }
  .topbar { position: static; padding: 10px 12px; }
  .tools { width: 100%; }
  #search { flex: 1; max-width: none; }
  .server { padding: 14px; }
  .server-head .links { display: none; }
  details.guests-wrap { overflow-x: auto; }
  .guests { font-size: 12px; }
  .cards { grid-template-columns: 1fr; }
}
