:root {
  --ink: #1b1714;
  --muted: #6b6158;
  --paper: #f6f0e6;
  --card: #fffaf3;
  --line: #e4d8c8;
  --accent: #0f6e62;
  --accent-2: #c45c26;
  --ok: #1f7a4d;
  --bad: #b42318;
  --warn: #b45309;
  --shadow: 0 18px 40px rgba(27, 23, 20, 0.08);
  --mono: "IBM Plex Mono", "Cascadia Mono", ui-monospace, monospace;
  --sans: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 500px at 10% -10%, #efe4d2 0%, var(--paper) 55%);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 10px;
}
.brand { font-family: var(--sans); font-size: 28px; letter-spacing: 0.02em; }
.nav { display: flex; gap: 8px; align-items: center; }
.nav a {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  font-weight: 600; text-decoration: none; background: #fff;
}
.nav a:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }
.nav a.active {
  background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700;
}
.hero { margin: 24px 0 28px; }
.hero h1 { font-family: var(--sans); font-size: 44px; margin: 0 0 8px; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }
.grid { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 160px; resize: vertical; font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,110,98,.12); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 999px; padding: 11px 18px; cursor: pointer;
  background: var(--ink); color: #fff; font-weight: 600;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost.is-current { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.accent { background: var(--accent); }
.btn.warn { background: var(--accent-2); }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.msg.err { background: #fde8e6; color: var(--bad); }
.msg.ok { background: #e8f6ee; color: var(--ok); }
.msg.info { background: #f3ece1; color: var(--muted); }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; font-size: 14px; }
.kv b { color: var(--muted); font-weight: 500; }
.help { white-space: pre-wrap; line-height: 1.7; color: #3c342d; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.tag {
  display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 12px;
  background: #efe6d8; color: var(--ink);
}
.tag.ok { background: #d9f2e3; color: var(--ok); }
.tag.bad { background: #fde2df; color: var(--bad); }
.tag.warn { background: #fce8cc; color: var(--warn); }
.hidden { display: none !important; }
.foot { padding: 40px 0; color: var(--muted); font-size: 13px; }

.admin-body { background: #efe8dc; height: 100vh; overflow: hidden; }
.shell {
  display: grid; grid-template-columns: 230px 1fr;
  height: 100%; overflow: hidden;
}
.side {
  background: #171310; color: #f4eadc; padding: 22px 16px;
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
}
.side .brand { color: #fff; font-size: 22px; margin-bottom: 24px; }
.side a {
  display: block; color: #d9cbb8; padding: 10px 12px; border-radius: 10px; margin-bottom: 4px;
}
.side a:hover, .side a.active { background: #2a241f; color: #fff; text-decoration: none; }
.main {
  padding: 24px; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
}
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
h2 { font-family: var(--sans); margin: 0 0 14px; }
.search-box {
  display: flex; align-items: stretch; gap: 8px;
  flex: 1 1 240px; min-width: 200px; max-width: 420px;
}
.search-box .search-input { width: 100%; min-width: 0; }
.search-box .search-btn { flex: 0 0 auto; white-space: nowrap; }
.pager {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 14px; color: var(--muted); font-size: 13px;
}
.pager-meta { margin-right: 4px; }
.pager-size {
  width: auto; padding: 6px 10px; border-radius: 999px; font-size: 13px;
}
.pager-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600;
}
.pager-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pager-btn.is-current {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.pager-ellipsis { padding: 0 4px; }
.dialog-mask {
  position: fixed; inset: 0; background: rgba(27, 23, 20, 0.35);
  display: flex; align-items: center; justify-content: center; z-index: 40;
  padding: 24px;
}
.dialog { width: min(520px, 100%); }
.dialog h3 { margin: 0 0 12px; }
.dialog-code {
  font-family: var(--mono); font-size: 16px; word-break: break-all;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px;
}
.ops { display: flex; flex-wrap: wrap; gap: 6px; }
.ops .btn { padding: 6px 12px; font-size: 12px; }

.progress-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.progress-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.progress-title { font-weight: 700; }
.progress-pct {
  font-family: var(--mono); font-size: 13px; color: var(--muted); font-weight: 600;
}
.progress-track {
  height: 10px; border-radius: 999px; background: #efe6d8; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f6e62, #27a392);
  transition: width .25s ease-out;
  position: relative;
}
.progress-bar.is-run::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: progress-sheen 1.4s linear infinite;
}
.progress-bar.is-ok { background: linear-gradient(90deg, #1f7a4d, #3cb371); }
.progress-bar.is-bad { background: linear-gradient(90deg, #c45c26, #e08a4f); }
.progress-hint {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; color: var(--muted); font-size: 13px; min-height: 20px;
}
.progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(15, 110, 98, .45);
  animation: progress-pulse 1.2s ease-out infinite;
}
.progress-dot.is-ok { background: var(--ok); animation: none; box-shadow: none; }
.progress-dot.is-bad { background: var(--accent-2); animation: none; box-shadow: none; }
.progress-actions { margin-top: 14px; }
.progress-panel.is-queue .progress-track,
.progress-panel.is-queue .progress-pct { display: none; }
@keyframes progress-sheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@keyframes progress-pulse {
  0% { box-shadow: 0 0 0 0 rgba(15, 110, 98, .45); }
  70% { box-shadow: 0 0 0 8px rgba(15, 110, 98, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 110, 98, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
  .progress-bar.is-run::after, .progress-dot { animation: none; }
}

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
}
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-num { font-family: var(--sans); font-size: 26px; font-weight: 700; }
.stat-num.ok { color: var(--ok); }
.stat-num.bad { color: var(--bad); }
@media (max-width: 860px) {
  .grid, .shell { grid-template-columns: 1fr; }
  .shell { grid-template-rows: auto 1fr; }
  .hero h1 { font-size: 32px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
