:root {
  --bg: #040810;
  --panel: rgba(8, 21, 38, 0.78);
  --border: rgba(103, 232, 249, 0.16);
  --text: #e7f6ff;
  --muted: #7f9db8;
  --dim: #506c84;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #fb7185;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(8, 51, 84, 0.5), transparent 70%),
    radial-gradient(ellipse 40% 40% at 95% 10%, rgba(139, 92, 246, 0.14), transparent 65%),
    linear-gradient(180deg, #050c18, #03060d 70%, #02040a);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 11px; }

/* ---------- 登录 ---------- */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(8, 51, 84, 0.45), transparent 70%),
    #040810;
}
.gate-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 30px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(11, 30, 52, 0.9), rgba(5, 14, 28, 0.9));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
}
.gate-card h1 { font-size: 20px; letter-spacing: 1px; }
.gate-card p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.gate-card label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); }
.gate-card input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(148, 183, 211, 0.2);
  border-radius: 8px;
  background: rgba(4, 14, 27, 0.8);
  outline: none;
}
.gate-card input:focus { border-color: rgba(34, 211, 238, 0.6); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1); }
.gate-card small { min-height: 16px; color: var(--red); font-size: 11px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, #a5f3fc, #22d3ee 45%, #818cf8);
  color: #04121c;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.4);
}
.primary {
  height: 38px;
  border: 1px solid rgba(103, 232, 249, 0.4);
  border-radius: 8px;
  background: linear-gradient(140deg, rgba(34, 211, 238, 0.32), rgba(99, 102, 241, 0.36));
  color: #eafdff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.16);
}
.primary:hover { box-shadow: 0 0 28px rgba(34, 211, 238, 0.3); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(103, 232, 249, 0.1);
  background: rgba(3, 9, 18, 0.82);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { font-size: 18px; letter-spacing: 1.5px; }
.brand p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  width: 210px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(148, 183, 211, 0.18);
  border-radius: 8px;
  background: rgba(6, 18, 33, 0.8);
  outline: none;
  font-size: 12px;
}
.search:focus { border-color: rgba(34, 211, 238, 0.5); }
.ghost {
  height: 32px;
  padding: 0 13px;
  border: 1px solid rgba(148, 183, 211, 0.2);
  border-radius: 8px;
  background: rgba(8, 22, 40, 0.72);
  color: #a9c3d8;
  font-size: 12px;
}
.ghost:hover { border-color: rgba(103, 232, 249, 0.4); color: #e0f7ff; }

/* ---------- 主内容 ---------- */
main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.card {
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(11, 30, 52, 0.72), rgba(5, 14, 28, 0.68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.card .label { color: var(--muted); font-size: 10.5px; letter-spacing: 0.4px; }
.card .value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f2fdff;
  text-shadow: 0 0 18px rgba(103, 232, 249, 0.22);
}
.card .sub { margin-top: 3px; color: var(--dim); font-size: 10px; }
.card.cyan .value { color: #a5f3fc; }
.card.violet .value { color: #ddd2ff; }
.card.amber .value { color: #ffe4ad; }
.card.green .value { color: #bbf7d0; }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 17px 11px;
}
.panel-head h2 { font-size: 13px; font-weight: 600; letter-spacing: 1.2px; color: #c8e9f8; }
.panel-head h2::before {
  content: "";
  display: inline-block;
  width: 3px; height: 12px;
  margin-right: 8px;
  border-radius: 2px;
  vertical-align: -2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 960px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(148, 183, 211, 0.08); }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(5, 16, 30, 0.96);
  color: var(--dim);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--cyan); }
th.sorted { color: #bdf4ff; }
tbody tr { cursor: pointer; transition: background 0.15s; }
tbody tr:hover { background: rgba(34, 211, 238, 0.05); }
tbody tr.disabled { opacity: 0.45; }
td { font-size: 12px; color: #b9d5e6; }
td.name { color: #e7f6ff; font-weight: 500; }
td.name small { display: block; margin-top: 2px; color: var(--dim); font-weight: 400; font-size: 9.5px; }
td.money { color: #ddd2ff; }
td.today { color: #ffe4ad; }
td.empty { color: var(--dim); font-size: 11px; text-align: center; padding: 28px; }
.footnote { padding: 11px 17px 16px; color: var(--dim); font-size: 10.5px; line-height: 1.6; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.badge.online { background: rgba(74, 222, 128, 0.12); color: #86efac; }
.badge.stale { background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.badge.offline { background: rgba(148, 183, 211, 0.1); color: #8aa5ba; }
.badge.disabled { background: rgba(251, 113, 133, 0.1); color: #fda4af; }

.lb-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lb-switch input {
  appearance: none;
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 9px;
  background: rgba(148, 183, 211, 0.2);
  cursor: pointer;
  transition: background 0.16s;
}
.lb-switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #dbeafe;
  transition: left 0.16s;
}
.lb-switch input:checked { background: linear-gradient(90deg, #22d3ee, #8b5cf6); }
.lb-switch input:checked::after { left: 15px; background: #fff; }
.lb-switch input:disabled { opacity: 0.5; cursor: default; }

.mini-rate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
  min-width: 92px;
}
.mini-track { width: 48px; height: 3px; border-radius: 2px; background: rgba(148, 183, 211, 0.12); overflow: hidden; }
.mini-fill { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #22d3ee, #8b5cf6); }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(1, 4, 9, 0.62); backdrop-filter: blur(3px); }
.drawer-body {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(620px, 94vw);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: linear-gradient(160deg, #07182a, #040b16);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.55);
  animation: slide-in 0.22s ease-out;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(148, 183, 211, 0.1);
}
.drawer-head h2 { font-size: 17px; }
.drawer-content { flex: 1; overflow: auto; padding: 18px 22px 30px; display: flex; flex-direction: column; gap: 15px; }
.detail-section h3 { font-size: 11px; color: var(--muted); letter-spacing: 1px; margin-bottom: 8px; font-weight: 500; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.detail-metric { padding: 10px 11px; border: 1px solid rgba(148, 183, 211, 0.1); border-radius: 9px; background: rgba(8, 22, 40, 0.6); }
.detail-metric .label { color: var(--dim); font-size: 9.5px; }
.detail-metric .value { margin-top: 4px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.status-list { display: flex; flex-wrap: wrap; gap: 6px; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(148, 183, 211, 0.07);
  color: #a9c3d8;
  font-size: 10.5px;
}
.status-chip i { width: 6px; height: 6px; border-radius: 2px; }
.data-list { display: flex; flex-direction: column; gap: 6px; }
.data-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px; gap: 8px; align-items: center; font-size: 11px; color: #b9d5e6; }
.data-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-row .num { text-align: right; font-variant-numeric: tabular-nums; color: #8fb4c9; }
.data-row .bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(148, 183, 211, 0.09); overflow: hidden; }
.data-row .bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, rgba(34, 211, 238, 0.75), rgba(139, 92, 246, 0.8)); }
.warning { padding: 9px 11px; border-radius: 8px; background: rgba(251, 191, 36, 0.08); color: #fcd34d; font-size: 11px; line-height: 1.5; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 10px);
  z-index: 80;
  padding: 8px 16px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 999px;
  background: rgba(4, 16, 30, 0.94);
  color: #d8f8ff;
  font-size: 11.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; padding: 12px 14px; }
  main { padding: 12px 14px 30px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { width: 100%; }
}