:root {
  /* 白 + 米黄。低饱和、暖调，尽量少的颜色层次。 */
  --bg: #fdfcf9;           /* 页面底色：近白 */
  --panel: #ffffff;        /* 卡片：纯白 */
  --panel-2: #f8f4ec;      /* 次级块：米黄 */
  --line: #e9e2d5;         /* 描边：浅米灰 */
  --text: #33302b;         /* 正文：暖深灰 */
  --muted: #8b8377;        /* 次要文字 */
  --accent: #c08a4a;       /* 主色：暖棕，克制使用 */
  --accent-soft: rgba(192, 138, 74, .10);
  --ok: #5f8a52;
  --ok-soft: #eef3e9;
  --warn: #b5813f;
  --warn-soft: #fbf3e4;
  --danger: #b8554f;
  --danger-soft: #fbeceb;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.shell { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------------- 侧边栏 */

.side {
  width: 248px; flex: 0 0 248px;
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.brand .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }

.nav { padding: 4px 10px 16px; flex: 1; }
.nav button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 12px; margin-bottom: 1px;
  background: transparent; border: 0; border-radius: 9px;
  color: #6f685d; font-size: 13.5px; font-family: inherit;
  text-align: left; cursor: pointer;
}
.nav button:hover { background: #f1ebdf; color: var(--text); }
.nav button.on { background: #ffffff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(90, 74, 50, .06); }
.nav button svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .7; }
.nav button.on svg { opacity: 1; color: var(--accent); }
.nav .label { flex: 1; line-height: 1.3; word-break: break-word; }
.nav .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav button.on .n { color: var(--accent); }

.sidefoot {
  padding: 14px 18px 18px; font-size: 11.5px; color: #a9a294;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- 主区 */

.main { flex: 1; min-width: 0; padding: 0 26px 48px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0 14px;
  background: rgba(253, 252, 249, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

#search {
  flex: 1; max-width: 460px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-size: 13.5px; outline: none;
  font-family: inherit;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#search::placeholder { color: #b3ab9d; }

.views { display: flex; gap: 6px; }
.views button {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.views button.on { background: var(--accent-soft); border-color: var(--accent); color: #8d6432; }

.notice {
  background: var(--warn-soft); border: 1px solid #eddcbc;
  color: #7d5b28; padding: 12px 16px; border-radius: 10px; margin: 0 0 20px; font-size: 13.5px;
}

/* ---------------------------------------------------------------- 卡片网格 */

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

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 14px;
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: #d9cdb6; box-shadow: 0 2px 10px rgba(120, 100, 70, .07); }

/* 元信息条：三个 chip 统一高度、统一字号、统一内边距 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; min-height: 22px; }
.chip {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px; border-radius: 6px;
  font-size: 11.5px; line-height: 1; font-weight: 500;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.mode-native { color: #8d6432; border-color: #e2cda8; background: #faf3e6; }
.chip.mode-template { color: #4f6b43; border-color: #d3dfc8; background: #eef3e9; }
.chip.mode-link { color: #4f6b43; border-color: #d3dfc8; background: #eef3e9; }
.chip.demo { color: #8a6a2f; border-color: #ecdcbb; background: #fdf4e2; }
.chip.third { color: #9c4c48; border-color: #eed3d1; background: var(--danger-soft); }
.chip.lic { color: #6f4f82; border-color: #e3d5ea; background: #f5eef8; }

.card h3 {
  margin: 0 0 6px; font-size: 15.5px; font-weight: 620; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .desc {
  margin: 0 0 13px; font-size: 13px; line-height: 1.6; color: #6f685d;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 41px;
}

.io {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  padding: 11px 12px; border-radius: 9px; background: var(--panel-2);
  border: 1px solid #efe8db; margin-bottom: 13px;
}
.io-row { display: grid; grid-template-columns: 34px 1fr; gap: 9px; align-items: baseline; }
.io-k { font-size: 11.5px; color: #a29a8c; letter-spacing: .3px; }
.io-v {
  font-size: 12.5px; color: #5a544b; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card .actions { margin-top: auto; display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 550;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  cursor: pointer; text-decoration: none; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: #dccfb8; background: #f3ecdf; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn.primary:hover { background: #b07c3f; border-color: #b07c3f; }
.btn:disabled { opacity: .55; cursor: default; }

.hint { font-size: 12px; color: #a29a8c; }
.hint.err { color: var(--danger); }

/* ---------------------------------------------------------------- 需求组 */

.reqgroup { margin: 0 0 32px; }
.reqhead {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 0 4px 11px; border-bottom: 1px solid var(--line); margin-bottom: 15px;
}
.reqhead h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .2px; }
.reqhead .cnt {
  font-size: 11.5px; padding: 2px 9px; border-radius: 6px;
  background: var(--accent-soft); color: #8d6432; border: 1px solid #e2cda8;
}
.reqhead .reqtitles { font-size: 12px; color: var(--muted); }

.sectitle {
  font-size: 13px; color: var(--muted); margin: 0 0 12px; padding-left: 2px;
}

/* ---------------------------------------------------------------- 通用表单块
   template.html / mcp.html 复用的输入区、输出区 */

.field input, .field select, .field textarea {
  background: #fff;
}
pre.log {
  background: var(--panel-2);
  color: #4a453e;
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 14px; }
  .nav button { width: auto; margin: 0; padding: 7px 11px; }
  .nav .n { display: none; }
  .main { padding: 0 16px 40px; }
}
