:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e6e8eb;
  --text: #1f2329;
  --muted: #8a9099;
  --primary: #2f6df6;
  --warn-bg: #fff7e6;
  --warn-line: #ffd591;
  --bad-bg: #fff1f0;
  --bad-line: #ffa39e;
  --ok: #389e0d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
}
.nav-link:hover { background: #f0f2f5; color: var(--text); }
.nav-link.active { background: #eaf1ff; color: var(--primary); font-weight: 600; }
.badge {
  font-size: 12px;
  color: var(--muted);
  background: #f0f2f5;
  padding: 4px 10px;
  border-radius: 999px;
  margin-left: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px 24px;
  align-items: start;
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.panel h2 { font-size: 15px; margin: 0 0 14px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions select, .actions input[type="text"] {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px;
}
.chk { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
button.mini { font-size: 12px; padding: 6px 12px; background: #f0f2f5; color: var(--text); }
button.mini:disabled { opacity: .5; cursor: not-allowed; }

.review-panel { margin: 0 24px 24px; }
.prompt-main { padding: 16px 24px; max-width: 900px; }

button.mini.save { background: var(--primary); color: #fff; }
.sub-label { font-size: 13px; margin: 6px 0 10px; color: var(--text); }
.field code {
  background: #f0f2f5; padding: 1px 5px; border-radius: 4px; font-size: 12px;
}

.scenario-list { display: flex; flex-direction: column; gap: 12px; }
.scenario {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
}
.scenario-head { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.scenario-head input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px;
}
.scenario-head .sc-key { width: 160px; font-family: ui-monospace, monospace; }
.scenario-head .sc-label { flex: 1; min-width: 120px; }
.scenario .sc-row { display: flex; gap: 8px; margin-bottom: 6px; }
.scenario .sc-row > label { flex: 1; font-size: 12px; color: var(--muted); }
.scenario textarea {
  width: 100%; margin-top: 3px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 13px;
  font-family: inherit; resize: vertical;
}
button.sc-del { background: #fff1f0; color: #cf1322; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}
.toggle-text { display: flex; flex-direction: column; gap: 2px; }
.toggle-text strong { font-size: 13px; font-weight: 600; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #c9ced6;
  border-radius: 999px;
  transition: background .2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch input:disabled + .switch-slider { opacity: .6; cursor: progress; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; margin-bottom: 6px; }
.field small { color: var(--muted); font-weight: normal; margin-left: 4px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.field textarea { resize: vertical; }

button {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}
button.primary { background: var(--primary); color: #fff; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); margin-left: 8px; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 14px; }
.space-info { font-size: 12px; color: var(--muted); margin-top: 8px; }

.status { font-size: 12px; color: var(--muted); font-weight: normal; }

.warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.debug-prompt {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fafbfc;
}
.debug-prompt summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.debug-call {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.debug-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.debug-role {
  display: inline-block;
  font-size: 11px;
  color: var(--primary);
  background: #eaf1ff;
  border-radius: 999px;
  padding: 2px 8px;
  margin: 8px 0 6px;
}
.debug-prompt pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.55;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.results { display: flex; flex-direction: column; gap: 12px; }

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.card.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.card-idx { font-weight: 600; font-size: 13px; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0f2f5;
  color: var(--muted);
}
.tag.ok { background: #f6ffed; color: var(--ok); }
.tag.bad { background: #fff1f0; color: #cf1322; }
.tag.warn { background: #fff7e6; color: #d46b08; }

.card-text { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.card-foot { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.copy-btn { font-size: 12px; padding: 4px 10px; background: #f0f2f5; color: var(--text); }
.hits { font-size: 12px; color: #cf1322; }
.empty { color: var(--muted); font-size: 14px; }
