:root {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c242e;
  --border: #2a333f;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, .14);
  --good: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, #58a6ff, #a371f7);
  display: grid; place-items: center; font-weight: 700; letter-spacing: .5px; color: #08111d;
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .3px; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-nav { display: flex; align-items: center; gap: 6px; }

input[type="date"], input[type="text"], input[type="password"],
input[type="datetime-local"], select, textarea {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font: inherit; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="date"] { width: 150px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 6px; font-size: 14px; color: var(--text); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
label.check input { width: auto; margin: 0; }

.btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 13px; font: inherit; font-size: 13px;
  cursor: pointer; white-space: nowrap; transition: .15s ease;
}
.btn:hover { border-color: #465667; background: #232d39; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #08111d; font-weight: 600; }
.btn.primary:hover { background: #79b8ff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: rgba(248, 81, 73, .35); background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-card strong { font-size: 26px; font-weight: 650; letter-spacing: -.5px; }
.stat-card small { font-size: 11px; color: var(--muted); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.chip { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
.chip.ok { color: var(--good); border-color: rgba(63, 185, 80, .35); }
.chip.warn { color: var(--warn); border-color: rgba(210, 153, 34, .4); }

.distribution { display: flex; flex-direction: column; gap: 10px; }
.dist-row { display: grid; grid-template-columns: 130px 1fr 72px; align-items: center; gap: 12px; font-size: 12px; }
.dist-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.dist-value { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 10px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.record {
  position: relative; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 15px; margin-bottom: 10px;
  display: grid; grid-template-columns: 118px 1fr auto; gap: 14px; align-items: center;
}
.record::before {
  content: ""; position: absolute; left: -20px; top: 22px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.record .time { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.record .time small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 2px; }
.record .body { min-width: 0; }
.record .summary { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record .meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.tag { border-radius: 5px; padding: 1px 6px; background: var(--accent-soft); color: var(--accent); }
.record .ops { display: flex; gap: 6px; }

.modal {
  position: fixed; inset: 0; background: rgba(3, 7, 12, .72);
  display: grid; place-items: center; padding: 20px; z-index: 20;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; width: min(460px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.modal-card h3 { margin: 0 0 16px; font-size: 16px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: -6px 0 16px; }
.msg { font-size: 12px; color: var(--good); margin: 12px 0 0; min-height: 16px; }

footer { text-align: center; color: var(--muted); font-size: 11px; margin-top: 26px; }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .record { grid-template-columns: 1fr; gap: 6px; }
  .record .ops { justify-content: flex-end; }
  .top-actions { width: 100%; }
}
