:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #3b9eff;
  --accent-dim: #2563a8;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #1a2a3a 0%, #0f1419 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 1.5rem;
}

header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  background: var(--accent-dim);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-weight: 500;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

section h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section h2 .num {
  background: var(--surface-2);
  color: var(--text-muted);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem 1rem;
}

.grid-full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

label.fixed {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
}

input,
select,
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.readonly-value {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.part-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
}

.part-card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: -0.35rem 0 0.75rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

button {
  font-family: inherit;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

button:hover {
  opacity: 0.88;
}

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

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

#results {
  border-color: var(--accent-dim);
}

.status-banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  line-height: 1.45;
}

.status-banner.pass {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.status-banner.fail {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.metric {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.metric-value.pass {
  color: var(--success);
}

.metric-value.fail {
  color: var(--danger);
}

.metric-unit {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.sub-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
}

.sub-metrics div {
  background: var(--bg);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  color: var(--text-muted);
}

.sub-metrics strong {
  color: var(--text);
}

.chart-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

.chart-row.bottleneck .chart-label {
  color: var(--warning);
  font-weight: 600;
}

.chart-row.bottleneck .chart-fill {
  background: var(--warning);
}

.chart-row.target-line .chart-fill.target {
  background: transparent;
  border: 2px dashed var(--accent);
  height: 100%;
  min-height: 18px;
}

.chart-label {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-track {
  background: var(--bg);
  border-radius: 4px;
  height: 18px;
  overflow: hidden;
}

.chart-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.4s ease;
}

.chart-value {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.78rem;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

@media (max-width: 600px) {
  .chart-row {
    grid-template-columns: 72px 1fr;
  }

  .chart-value {
    grid-column: 2;
    margin-top: -0.25rem;
    margin-bottom: 0.35rem;
  }
}
