:root {
  --bg: #0a0a10;
  --panel: #12121a;
  --panel2: #1a1a29;
  --border: #242435;
  --text: #f0f0f5;
  --muted: #9a9ab0;
  --accent: #4cc2ff;
  --accent2: #7b42ff;
  --green: #0ecb81;
  --red: #f6465d;
  --warn: #e6a23c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #0d0d16;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: 8px;
}
.nav a {
  color: var(--muted);
  margin-right: 14px;
  font-size: 14px;
}
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; }
.topbar .right { margin-left: auto; color: var(--muted); font-size: 13px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.stat { font-size: 28px; font-weight: 700; }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #3aa8e0, #6a3ad8);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn.secondary { background: #2a2a3d; }
.btn.danger { background: #8b2e3c; }
.btn:hover { filter: brightness(1.08); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #2e2e45;
  background: var(--panel2);
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; margin: 0 0 6px; color: #a9a9ff; font-size: 13px; }
.form-row { margin-bottom: 12px; }
.issue-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.issue-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #161622;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.issue-chip input {
  accent-color: var(--accent);
  margin: 0;
}
.issue-chip:has(input:checked) {
  border-color: rgba(246, 70, 93, 0.55);
  background: rgba(246, 70, 93, 0.12);
  color: #ffb4bc;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #222235;
}
.tag.green { color: var(--green); background: rgba(14,203,129,.12); }
.tag.red { color: var(--red); background: rgba(246,70,93,.12); }
.tag.gray { color: var(--muted); }

.callout {
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(230, 162, 60, 0.45);
  background: rgba(230, 162, 60, 0.08);
}
.callout h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--warn);
}
.callout ol {
  margin: 8px 0 0;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.65;
}
.callout code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.callout pre {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0d0d16;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  color: #e8e8f0;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}
.flash.ok { background: rgba(14,203,129,.12); color: var(--green); }
.flash.error { background: rgba(246,70,93,.12); color: var(--red); }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.chart-box {
  background: #0e0e18;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  min-height: 240px;
}
.chart-box h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.chart-zoom-hint {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
}
.chart-canvas {
  width: 100%;
  height: 240px;
  display: block;
  cursor: zoom-in;
}
.empty-chart {
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
/* 作者样式会盖掉 UA 的 [hidden]{display:none}，必须显式隐藏 */
.empty-chart[hidden] {
  display: none !important;
}

.chart-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.chart-lightbox[hidden] { display: none !important; }
.chart-lightbox-panel {
  width: min(1100px, 96vw);
  background: #12121c;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.chart-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.chart-lightbox-title {
  font-size: 15px;
  font-weight: 700;
}
.chart-lightbox-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.chart-lightbox-close:hover { color: #fff; }
.chart-lightbox-hint { margin: 0 0 10px; font-size: 12px; }
.chart-lightbox-canvas {
  width: 100%;
  height: min(62vh, 520px);
  display: block;
  border-radius: 10px;
  background: #0e0e18;
}
