:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e3e8ef;
  --line-soft: #edf1f6;
  --text: #1c2533;
  --muted: #6b7787;
  --dim: #98a3b3;
  --brand: #1f6feb;
  --brand-soft: #e8f0fe;
  --ok: #12804a;
  --ok-soft: #e6f6ee;
  --err: #c4314b;
  --err-soft: #fdecef;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶栏 ---------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; }

.logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(160deg, #2b7bf3, #1a5fd0);
  color: #fff;
  font: 700 13px/34px var(--mono);
  text-align: center;
  letter-spacing: .5px;
  box-shadow: 0 2px 8px rgba(31, 111, 235, .25);
}

.brand h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.brand p { margin: 0; font-size: 11.5px; color: var(--dim); }

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

.safe {
  font-size: 11.5px;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid #c6e8d6;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------------- 布局 ---------------- */
.layout {
  display: flex;
  max-width: 1180px;
  margin: 0 auto;
  gap: 22px;
  padding: 20px 22px 80px;
  align-items: flex-start;
}

.side {
  width: 172px;
  flex: 0 0 172px;
  position: sticky;
  top: 74px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: .15s;
  border: 1px solid transparent;
}
.nav-item:hover { background: #fff; color: var(--text); border-color: var(--line); }
.nav-item.active {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

main { flex: 1; min-width: 0; }

/* ---------------- 面板 ---------------- */
.panel { display: flex; flex-direction: column; gap: 13px; }
.panel.hidden { display: none; }

.panel-head { padding: 2px 2px 4px; }
.panel-head h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.4px; font-weight: 660; }
.lead { margin: 0; color: var(--muted); font-size: 13px; max-width: 720px; line-height: 1.75; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px 16px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 620; }
.flow {
  font-size: 11px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 5px;
  padding: 1px 7px;
  margin-left: 6px;
}
.card-tools { display: flex; gap: 6px; }

.mini {
  font: inherit;
  font-size: 11.5px;
  color: var(--muted);
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.mini:hover { color: var(--brand); border-color: #b9cff5; background: #f3f7ff; }

/* ---------------- 输入 ---------------- */
textarea, .line, input[type=text] {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
  transition: .15s;
  resize: vertical;
}
textarea { min-height: 76px; line-height: 1.65; }
textarea::placeholder, input::placeholder { color: var(--dim); }
textarea:focus, input:focus {
  border-color: #9dc0f8;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .12);
  background: #fff;
}

textarea.mono, .out.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .2px;
}

.out {
  margin-top: 10px;
  background: #f8fafc;
  border-style: dashed;
  color: #24405f;
}

.kv { margin-top: 10px; }
.kv label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 5px;
}
.kv textarea { min-height: 0; height: auto; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hint { font-size: 11.5px; color: var(--dim); line-height: 1.6; }
.dim { color: var(--dim); font-weight: 400; }

/* ---------------- 按钮 ---------------- */
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .16s;
  white-space: nowrap;
}
.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 3px rgba(31, 111, 235, .3);
}
.btn.primary:hover { background: #1a63d2; }
.btn.primary:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost {
  background: #fff;
  color: var(--muted);
  border-color: var(--line);
}
.btn.ghost:hover { color: var(--text); border-color: #ccd6e2; }
.btn.small { font-size: 12px; padding: 5px 11px; }

/* ---------------- 选项 ---------------- */
.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.opt-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opt-label { font-size: 11.5px; color: var(--dim); letter-spacing: .3px; }

.radio, .check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}
.radio input, .check input { accent-color: var(--brand); margin: 0; }

/* ---------------- 结果 ---------------- */
.result {
  margin-top: 11px;
  padding: 10px 13px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed var(--line);
  font-size: 13px;
  color: var(--muted);
}
.result.ok {
  background: var(--ok-soft);
  border: 1px solid #c6e8d6;
  color: var(--ok);
  font-weight: 600;
}
.result.bad {
  background: var(--err-soft);
  border: 1px solid #f5cbd3;
  color: var(--err);
  font-weight: 600;
}

/* ---------------- 文档 ---------------- */
.doc {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.9;
}
.doc b { color: var(--text); font-weight: 600; }
.doc code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: #f1f4f9;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  background: #1c2533;
  color: #fff;
  font-size: 12.5px;
  padding: 8px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 70;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: #a3243c; }

.hidden { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; padding: 14px 14px 70px; gap: 14px; }
  .side {
    position: static;
    width: 100%;
    flex: none;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }
  .nav-item { white-space: nowrap; border: 1px solid var(--line); background: #fff; }
  .safe { display: none; }
  .top { padding: 10px 14px; }
  .panel-head h2 { font-size: 18px; }
}
