:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #9a9a9f;
  --line: #e8e8e5;
  --line-strong: #d7d7d3;
  --accent: #2f6fed;
  --accent-soft: #eef3ff;
  --good: #1f8a4c;
  --warn: #b26a00;
  --bad: #c0362c;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 13.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 251, 250, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(10px);
}

.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--text);
  display: inline-block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 13px;
}

.nav a:hover {
  color: var(--text);
  background: #f1f1ee;
}

.nav a.active {
  color: var(--text);
  font-weight: 550;
  background: #efefec;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.state-bad {
  color: var(--bad);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  display: inline-block;
}

.dot-muted {
  background: var(--faint);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 24px 72px;
}

.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 32px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 11.5px;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
}

h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.005em;
}

p {
  margin: 0;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.faint {
  color: var(--faint);
}

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

.muted {
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  min-height: 30px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  overflow: hidden;
}

.seg a {
  padding: 5px 10px;
  text-decoration: none;
  font-size: 12.5px;
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.seg a:last-child {
  border-right: 0;
}

.seg a.on {
  background: #efefec;
  color: var(--text);
  font-weight: 550;
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover,
button.btn:hover {
  background: #f4f4f1;
}

.btn.primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.btn.primary:hover {
  background: #333;
}

.btn.danger {
  color: var(--bad);
  border-color: #e7c3bf;
}

.btn.danger:hover {
  background: #fdf1f0;
}

.btn.small {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.kpi {
  padding: 16px 18px 15px;
  border-right: 1px solid var(--line);
}

.kpi:last-child {
  border-right: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  line-height: 1;
  font-weight: 550;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  margin-top: 6px;
  color: var(--faint);
  font-size: 11.5px;
}

.section {
  margin-top: 30px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-head .meta {
  font-size: 11.5px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover {
  background: #f8f8f6;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.name {
  font-weight: 520;
  text-decoration: none;
}

.name:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sub {
  display: block;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 1px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.pill .dot {
  width: 6px;
  height: 6px;
}

.tone-good .dot,
.dot.tone-good {
  background: var(--good);
}

.tone-warn .dot,
.dot.tone-warn {
  background: var(--warn);
}

.tone-bad .dot,
.dot.tone-bad {
  background: var(--bad);
}

.tone-muted .dot,
.dot.tone-muted {
  background: var(--faint);
}

.tone-good {
  color: var(--good);
}

.tone-warn {
  color: var(--warn);
}

.tone-bad {
  color: var(--bad);
}

.tone-muted {
  color: var(--faint);
}

.score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.conf {
  color: var(--faint);
  font-size: 11px;
  margin-left: 5px;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #fafaf8;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}

.dots {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--good);
}

.dots i.miss {
  background: var(--bad);
}

.answer {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #f6f6f3;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  padding: 34px 9px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.6fr);
  gap: 32px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-body {
  padding: 16px 18px;
}

.panel + .panel {
  margin-top: 18px;
}

.dl {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 7px 12px;
  font-size: 12.5px;
}

.dl dt {
  color: var(--muted);
}

.dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.big-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.big-score strong {
  font-size: 36px;
  line-height: 1;
  font-weight: 550;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.bars {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.bar-track {
  height: 4px;
  background: #efefec;
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
}

.bar-row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.form {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

label.field {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

label.field > span {
  color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

textarea {
  height: auto;
  min-height: 60px;
  padding: 7px 9px;
  resize: vertical;
}

select[multiple] {
  height: auto;
  min-height: 88px;
  padding: 5px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(47, 111, 237, 0.25);
  outline-offset: 0;
  border-color: var(--accent);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 9px;
}

.form-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.notice {
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #27406f;
}

.danger-note {
  border-left-color: var(--bad);
  background: #fdf3f2;
  color: #7d2a24;
}

details {
  font-size: 12.5px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

summary:hover {
  color: var(--text);
}

pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #f6f6f3;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  max-height: 320px;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tabs a {
  padding: 7px 11px;
  margin-bottom: -1px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 12.5px;
}

.tabs a.on {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 550;
}

.back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

.back:hover {
  color: var(--text);
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.inline {
  display: inline;
}

.rule-state {
  font-size: 12px;
}

.code-list {
  display: grid;
  gap: 2px;
  font-family: var(--mono);
  font-size: 11px;
}

@media (max-width: 860px) {
  .split,
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
  }
  .kpi:nth-child(2) {
    border-right: 0;
  }
  .kpi:nth-child(1),
  .kpi:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }
  .top-inner {
    gap: 14px;
  }
  .nav {
    gap: 0;
  }
  .nav a {
    padding: 5px 7px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 20px 14px 56px;
  }
  .top-inner {
    padding: 0 14px;
  }
  .foot {
    padding: 0 14px 24px;
  }
  table {
    font-size: 12px;
  }
  th,
  td {
    padding: 8px 6px;
  }
  .hide-sm {
    display: none;
  }
}
