@import url("/css/nav.css");
:root {
  --bg: #f4f1ea;
  --paper: #fffcf6;
  --ink: #1c1915;
  --muted: #6b6459;
  --line: #e4ddd0;
  --brand: #1f4d3a;
  --brand-2: #c46a2b;
  --ok: #2e7d4f;
  --warn: #b45309;
  --bad: #b42318;
  --chip: #efe8da;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 500px at 10% -10%, #e7efe8, transparent 50%), var(--bg);
  color: var(--ink);
}
a { color: var(--brand); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 18px 64px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 30px rgba(40, 28, 10, 0.04);
  margin-bottom: 16px;
}
h1, h2, h3 { margin: 0 0 10px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 92px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 13px;
  line-height: 1.2;
}
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.warn { background: var(--brand-2); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="date"] { width: auto; padding: 5px 8px; font-size: 13px; border-radius: 8px; }
.nowrap { white-space: nowrap; }
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 4px; padding: 0;
  border: 1px solid var(--muted); border-radius: 50%;
  background: #fff; color: var(--muted); font-size: 11px; line-height: 1;
  cursor: pointer; vertical-align: middle;
}
.help:hover { color: var(--brand); border-color: var(--brand); }
.modal-bg {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(28, 25, 21, 0.36);
}
.modal {
  display: flex; flex-direction: column;
  width: min(640px, 100%); max-height: 86vh; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 0;
  box-shadow: 0 16px 40px rgba(40, 28, 10, 0.12);
}
.modal.settings { width: min(480px, 100%); }
.modal.settings .hint a { word-break: break-all; }
.set-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.set-key-row label { margin: 0; }
.set-key-row .btn { flex: none; }
.modal-top, .modal-foot { flex: none; padding: 16px 18px; }
.modal-top { border-bottom: 1px solid var(--line); }
.modal-top h3 { margin: 0 0 6px; }
.modal-top .hint { margin: 0; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 18px 16px; }
.modal-foot { border-top: 1px solid var(--line); }
.modal-foot .rule-sum, .modal-foot .err { margin: 0 0 8px; }
.modal textarea { min-height: 280px; font-size: 13px; line-height: 1.55; }
.busy-status {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.busy-status.on { display: block; }
.busy-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.busy-spin {
  width: 14px; height: 14px; flex: none;
  border: 2px solid #e5e7eb; border-top-color: var(--brand);
  border-radius: 50%; animation: zb-spin 0.7s linear infinite;
}
.busy-bar { height: 6px; margin-top: 8px; background: #efe8da; border-radius: 99px; overflow: hidden; }
.busy-bar > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width 0.35s ease; }
@keyframes zb-spin { to { transform: rotate(360deg); } }
.rule-item {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.rule-item label { margin: 0 0 6px; color: var(--ink); font-weight: 600; }
.rule-item textarea { min-height: 58px; }
.rule-item input { font-weight: 600; }
.rule-head { display: flex; gap: 8px; align-items: flex-end; }
.rule-head .name { flex: 1; min-width: 0; }
.rule-head .pts { width: 88px; flex: none; }
.rule-head .pts input { width: 100%; }
.rule-sum { margin: 8px 0 0; font-weight: 700; }
.rule-sum.off { color: var(--bad); }
.rule-sum.ok { color: var(--ok); }
.kind-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: -4px 0 18px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.kind-switch a {
  min-width: 76px;
  padding: 8px 20px;
  border-radius: 9px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
}
.kind-switch a.on { background: var(--brand); color: #fff; }
.kind-switch a:hover:not(.on) { background: #fff; }
.period-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.period-chips a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.period-chips a:hover { border-color: var(--brand); color: var(--brand); }
.period-chips a.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.period-chips a.ready:not(.on) { background: #eef6f0; }
.toolbar input[type="month"],
.toolbar input[type="number"] { width: auto; padding: 5px 8px; font-size: 13px; border-radius: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { padding: 12px; border-radius: 12px; background: var(--chip); }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.bad b { color: var(--bad); }
.stat.ok b { color: var(--ok); }
.stat.warn b { color: var(--warn); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.score-cell { max-width: 28em; }
.score-line {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--chip); }
.tag.ok { background: #d8efe0; color: var(--ok); }
.tag.bad { background: #f8d7d4; color: var(--bad); }
.tag.warn { background: #fde8c8; color: var(--warn); }
.hint { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); margin: 8px 0; }
.okmsg { color: var(--ok); margin: 8px 0; }
.pre { white-space: pre-wrap; line-height: 1.65; }
.login { max-width: 360px; margin: 12vh auto; }
.upload {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  margin-top: 8px;
}
.upload .row { margin-top: 8px; }
.files a { margin-right: 12px; }
.table-input { width: 100%; max-width: 160px; padding: 6px 8px; border-radius: 8px; }
.table-input.sort { max-width: 72px; }
.table-input.phone { max-width: 128px; }
.btn.mini { padding: 6px 10px; font-size: 12px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); }
label.inline input { width: auto; }
tr.off { opacity: 0.55; }
tr.on-row td { background: #efe8da; }
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
