:root {
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #0d1117;
  color: #e6edf3;
  font: 14px/1.6 system-ui, "Microsoft YaHei", sans-serif;
}
#nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px;
  background: rgba(13,17,23,.92);
  border-bottom: 1px solid #30363d;
  backdrop-filter: blur(4px);
}
.brand { font-weight: 700; font-size: 15px; }
.src-badge {
  margin-left: auto;
  padding: 2px 10px; border-radius: 999px; font-size: 12px;
  color: #3fb950; border: 1px solid #3fb950; white-space: nowrap;
}
.src-badge.fallback { color: #d29922; border-color: #d29922; }
#nav nav { display: flex; gap: 4px; }
#nav a {
  color: #8b949e; text-decoration: none; padding: 6px 12px; border-radius: 6px;
}
#nav a:hover { color: #e6edf3; }
#nav a.active { color: #e6edf3; background: #1c2128; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 24px 60px; }
h3 { margin: 0 0 10px; font-size: 15px; }
.loading, .empty { color: #8b949e; text-align: center; padding: 40px 0; }
.dim { color: #8b949e; font-size: 12px; }
.link { color: #58a6ff; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card {
  background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 16px;
}
.card .k { color: #8b949e; font-size: 12px; }
.card .v { font-size: 26px; font-weight: 700; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }

input, select, textarea {
  background: #0d1117; border: 1px solid #30363d; color: #e6edf3;
  padding: 6px 10px; border-radius: 6px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 1px solid #58a6ff; }
textarea { resize: vertical; }

button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 6px 12px;
  background: transparent; color: #e6edf3; border: 1px solid #30363d;
}
button:hover { background: #1c2128; }
button.primary { background: #238636; border-color: #2ea043; }
button.primary:hover { background: #2ea043; }
button.ghost { background: transparent; }
button.danger { color: #f85149; border-color: #f85149; }
button.danger:hover { background: rgba(248,81,73,.1); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid #21262d; text-align: left; vertical-align: middle; }
th { color: #8b949e; font-weight: 600; font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: #1c2128; }
td.ops { white-space: nowrap; }
.ops { display: flex; gap: 6px; }
.ops button, .ops a.link { font-size: 12px; padding: 2px 8px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; color: #fff; background: var(--c); white-space: nowrap;
}

.dist { display: flex; gap: 10px; align-items: center; margin: 7px 0; }
.dist-label { width: 68px; color: #8b949e; font-size: 13px; }
.dist-bar { flex: 1; background: #21262d; height: 12px; border-radius: 6px; overflow: hidden; }
.dist-bar > div { height: 100%; border-radius: 6px; }
.dist-n { width: 28px; text-align: right; color: #8b949e; font-size: 13px; }
.recent { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #21262d; }
.recent .dim { flex: 1; text-align: right; }

.chart { width: 100%; height: auto; }
.chart text { font-family: inherit; }

#modal-root:empty { display: none; }
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px;
}
.modal {
  background: #161b22; border: 1px solid #30363d; border-radius: 10px;
  width: min(600px, 94vw); max-height: 86vh; overflow: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #30363d; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px 18px; display: grid; gap: 10px; }
.fld { display: grid; gap: 4px; }
.fld > span { font-size: 12px; color: #8b949e; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.history-box { color: #8b949e; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  max-width: 80vw; background: #1c2128; border: 1px solid #30363d;
  color: #e6edf3; padding: 9px 18px; border-radius: 8px; font-size: 13px;
  z-index: 300; opacity: 0; pointer-events: none; transition: opacity .25s;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; }

.pager { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager button:disabled:hover { background: transparent; }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .cmp-grid { grid-template-columns: 1fr; } }
