:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --line: #e3e7ee;
  --brand: #10a37f;
  --brand-dark: #0c7f62;
  --danger: #d6455d;
  --warn: #c98600;
  --ok: #138a5b;
  --info: #2f6fed;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.06), 0 6px 20px rgba(20, 30, 50, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b212a;
    --text: #e8edf4;
    --muted: #98a3b3;
    --line: #2b3441;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
h1, h2, h3 { line-height: 1.3; margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: var(--info); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.wrap { max-width: 680px; margin: 0 auto; padding: 24px 16px 64px; }
.wrap.wide { max-width: 1180px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.banner {
  background: #fff4d6; color: #7a5600; border: 1px solid #f0d68a;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px;
}
@media (prefers-color-scheme: dark) { .banner { background: #3a3012; color: #f2d98c; border-color: #5b4a17; } }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
input[type="checkbox"] { width: auto; }

button, .btn {
  display: inline-block; cursor: pointer; font: inherit; font-weight: 600;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: #fff;
}
button:hover { background: var(--brand-dark); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.secondary:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
button.danger { background: var(--danger); }
button.small { padding: 4px 10px; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 160px; }
/* 同一行里的表单控件按内容宽度排布，不要撑满整行 */
.row select, .row input:not(.grow) { width: auto; min-width: 120px; }
.row input.grow { width: auto; min-width: 140px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; border: 1px solid; }
.alert.err { background: #fde8ec; color: #a1243a; border-color: #f6c3cd; }
.alert.ok { background: #e3f6ec; color: #0e6a45; border-color: #b9e6cf; }
.alert.info { background: #e6effe; color: #1f4fb8; border-color: #c1d4fa; }
@media (prefers-color-scheme: dark) {
  .alert.err { background: #3b1a22; color: #f4a9b6; border-color: #5e2a36; }
  .alert.ok { background: #14352a; color: #94dfbb; border-color: #1f5740; }
  .alert.info { background: #172a4d; color: #a9c4f7; border-color: #26437a; }
}
.alert ul { margin: 6px 0 0; padding-left: 20px; }

.status { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.run { background: var(--info); animation: pulse 1.2s infinite; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }
.dot.warn { background: var(--warn); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.ref { font-family: ui-monospace, Menlo, Consolas, monospace; background: color-mix(in srgb, var(--text) 8%, transparent); padding: 2px 8px; border-radius: 6px; }

/* 管理后台 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: transparent; color: var(--text); border: 1px solid var(--line); }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--danger); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.tag.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tag.bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.tag.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.tag.run { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.modal { position: fixed; inset: 0; background: rgba(10, 15, 25, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 10; }
.modal .card { max-width: 720px; width: 100%; margin: 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
pre { background: color-mix(in srgb, var(--text) 7%, transparent); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; margin: 6px 0 0; }
