/* 最优样本选择系统 · 统一样式（响应式 + 移动端友好） */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f4f6fa;
  color: #1f2937;
  line-height: 1.55;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Header ---- */
.site-header {
  background: linear-gradient(120deg, #065f46 0%, #10b981 100%);
  color: #fff;
  padding: 16px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.logo {
  color: #fff; text-decoration: none;
  font-weight: 700; font-size: 18px;
  display: inline-flex; align-items: center; gap: 8px;
}
.logo .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.22);
  font-size: 12px;
  font-weight: 600;
}
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a {
  color: #d1fae5; text-decoration: none; font-size: 15px;
  padding: 4px 8px; border-radius: 4px;
}
.site-header nav a:hover { background: rgba(255,255,255,0.15); color: #fff; }

main { padding: 28px 0 60px; min-height: calc(100vh - 180px); }

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(20,40,80,0.05);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 6px 0; }
.card h3 { margin: 18px 0 8px 0; }

.muted { color: #6b7280; font-size: 14px; }
.muted.small { font-size: 12.5px; }

.notice {
  margin: 14px 0 4px;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-size: 14px;
}

.guide-box {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
}
.guide-box h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.guide-box ol {
  margin: 0;
  padding-left: 22px;
}
.guide-box li {
  margin: 6px 0;
  color: #374151;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-size: 13.5px; color: #374151; font-weight: 600;
}
.form-field .range { color: #9ca3af; font-weight: 400; margin-left: 4px; }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
  background: #fff;
}
.form-field textarea { min-height: 60px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.btn-row {
  display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap;
  align-items: center;
}

.btn, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn { background: #10b981; color: #fff; }
.btn:hover { background: #059669; }
.btn-secondary { background: #e5e7eb; color: #1f2937; }
.btn-secondary:hover { background: #d1d5db; }
.btn-ghost { background: transparent; color: #374151; border: 1px solid #d1d5db; }
.btn-ghost:hover { background: #f3f4f6; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.small { font-size: 12.5px; padding: 4px 10px; }

.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  padding: 10px 14px; border-radius: 6px;
  font-size: 14.5px;
}
.flash-ok    { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-warn  { background: #fef3c7; color: #92400e; }

/* ---- Result page ---- */
.result-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 10px;
}
.result-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12.5px;
  font-weight: 600;
}
.tag-optimal { background: #10b981; color: #fff; }
.tag-near    { background: #3b82f6; color: #fff; }
.tag-heur    { background: #f59e0b; color: #fff; }

table.kv {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}
table.kv th, table.kv td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14.5px;
}
table.kv th { color: #6b7280; font-weight: 500; width: 35%; }

.groups {
  padding-left: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 16px;
}
.groups li code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

/* ---- Manage page ---- */
.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin: 16px 0;
  align-items: end;
}
.filter-form button, .filter-form a { height: 38px; line-height: 1; }

table.runs {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 14px;
}
table.runs th, table.runs td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}
table.runs thead { background: #f9fafb; color: #374151; }
table.runs tbody tr:hover { background: #f9fafb; }
table.runs code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }

.layer-list { padding-left: 22px; margin: 10px 0; }
.layer-list li { margin: 6px 0; }

code { font-family: Menlo, Consolas, "Courier New", monospace; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  padding: 14px 0;
  color: #6b7280;
  font-size: 13px;
}
.site-footer .wrap {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
  .card { padding: 18px; }
  .form-grid { gap: 10px; }
  .logo { font-size: 15px; }
  table.runs { font-size: 13px; }
  table.runs th, table.runs td { padding: 6px 8px; }
  .groups { grid-template-columns: 1fr; }
}
