@font-face {
  font-family: "Board Sans";
  src: url("fonts/NotoSansCJK-Regular.ttc") format("collection");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Board Sans";
  src: url("fonts/NotoSansCJK-Bold.ttc") format("collection");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root,
html[data-theme="day"] {
  --bg: #eef3f0;
  --panel: #ffffff;
  --panel-2: #f5f8f6;
  --line: #d4dfd9;
  --text: #163028;
  --muted: #5d7269;
  --accent: #1f9d72;
  --accent-2: #14785a;
  --warn: #c39216;
  --bad: #d24b4b;
  --good: #1f9d72;
  --shadow: 0 14px 30px rgba(22, 48, 40, 0.08);
  --radius: 16px;
  --bar-track: #dce7e1;
  --glow-1: rgba(31, 157, 114, 0.12);
  --glow-2: rgba(80, 140, 255, 0.08);
}

html[data-theme="night"] {
  --bg: #0b1110;
  --panel: #121a18;
  --panel-2: #18221f;
  --line: #2a3b36;
  --text: #e7f3ee;
  --muted: #93a8a0;
  --accent: #3dcb9a;
  --accent-2: #7ee0b8;
  --warn: #e4c15a;
  --bad: #ef6b6b;
  --good: #3dcb9a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --bar-track: #22302c;
  --glow-1: rgba(61, 203, 154, 0.14);
  --glow-2: rgba(80, 140, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--glow-1), transparent 50%),
    radial-gradient(800px 400px at 100% 0%, var(--glow-2), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: "Board Sans", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body { padding: 28px 32px 48px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card, .card, .hero, .topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(440px, 100%);
  padding: 36px 32px 32px;
  border-radius: 22px;
}

h1, h2, h3 { margin: 0 0 8px; letter-spacing: 0.02em; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sub, .muted { color: var(--muted); }
.sub { margin: 0 0 22px; line-height: 1.6; }

label {
  display: block;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

input, button {
  font: inherit;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

button {
  margin-top: 18px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #062018;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  width: auto;
  margin: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.banner {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.banner.error {
  background: rgba(210, 75, 75, 0.12);
  color: var(--bad);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

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

.user-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--accent-2);
}

.entry-line {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}
.entry-line a,
.url-line a {
  color: var(--accent-2);
  text-decoration: none;
  word-break: break-all;
}
.theme-toggle { min-width: 72px; }

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px 24px;
  margin: 0;
}
.hero-stats dt { color: var(--muted); font-size: 12px; }
.hero-stats dd { margin: 4px 0 0; font-size: 18px; }

.grid, .service-grid, .split {
  display: grid;
  gap: 16px;
}

.metrics { grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.split { grid-template-columns: 1fr 1fr; margin: 16px 0 22px; }
.service-grid { grid-template-columns: repeat(3, 1fr); }

.card {
  padding: 18px;
  border-radius: var(--radius);
}

.metric { font-size: 22px; margin: 8px 0 12px; }

.bar {
  height: 8px;
  background: var(--bar-track);
  border-radius: 999px;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #6ee7c2);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 2px 12px;
}

.service {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.service-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  background: var(--warn);
}
.dot.ok { background: var(--good); box-shadow: 0 0 0 4px rgba(61, 203, 154, 0.16); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(239, 107, 107, 0.14); }
.service-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.service a {
  color: var(--accent-2);
  text-decoration: none;
}
.service p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}
.auth-badge small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.88;
}
.auth-on {
  color: #0b2a20;
  background: rgba(61, 203, 154, 0.9);
}
.auth-partial {
  color: #3a2d07;
  background: rgba(228, 193, 90, 0.92);
}
.auth-off {
  color: #3a1010;
  background: rgba(239, 107, 107, 0.9);
}
.auth-local {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-color: var(--line);
}

.url-box {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.url-box .url-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}
.url-line {
  display: block;
  margin: 3px 0;
  font-size: 12px;
}
.service-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
button.stop {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  background: transparent;
  color: var(--bad);
  border: 1px solid var(--bad);
  font-size: 12px;
}
button.stop:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(42, 59, 54, 0.8);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }

@media (max-width: 1100px) {
  .metrics, .service-grid, .split, .hero { grid-template-columns: 1fr 1fr; }
  .hero { display: grid; }
}
@media (max-width: 720px) {
  body { padding: 16px; }
  .topbar, .hero, .metrics, .service-grid, .split, .hero-stats, .top-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* ---------- 服务器集群 ---------- */
.fleet-totals {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.total-cell {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.total-label { color: var(--muted); font-size: 12px; }
.total-cell strong { font-size: 18px; }
.total-sub { color: var(--muted); font-size: 12px; }

.fleet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.fleet-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fleet-card.offline { border-color: var(--bad); background: var(--panel-2); }
.fleet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fleet-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; }
.fleet-role { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.region-pill {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.fleet-metric { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 8px; }
.fleet-metric > span { color: var(--muted); font-size: 12px; }
.fleet-metric > em { grid-column: 2; font-style: normal; color: var(--muted); font-size: 11px; }
.bar.slim { height: 6px; }

.fleet-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 2px 0 0;
}
.fleet-facts div { display: flex; justify-content: space-between; gap: 8px; }
.fleet-facts dt { color: var(--muted); font-size: 12px; }
.fleet-facts dd { margin: 0; font-size: 12px; text-align: right; }

.fleet-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.fleet-note { margin: 0; color: var(--muted); font-size: 12px; }
.fleet-error { margin: 0; color: var(--bad); font-size: 13px; }

.alert-list { display: grid; gap: 6px; margin-top: 14px; }
.alert {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: var(--panel-2);
  border-left: 3px solid var(--muted);
}
.alert-warn { border-left-color: var(--warn); }
.alert-error { border-left-color: var(--bad); }
.alert-ok { border-left-color: var(--good); color: var(--muted); }

@media (max-width: 1100px) {
  .fleet-totals { grid-template-columns: repeat(3, 1fr); }
  .fleet-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .fleet-totals, .fleet-grid { grid-template-columns: 1fr; }
}
