/* 飞鸽个人版主题参考：uniapp globalStyle / tabBar / .btn-primary 使用 #3d6a9e；整页底 #f0f5fc */
:root {
  --bg: #ffffff;
  --bg-alt: #eaf5fc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3d6a9e;
  --accent-hover: #345d8a;
  --aux-llm-title: #b45309;
  --aux-llm-title-hover: #92400e;
  --border: #c5d4e0;
  --pre-bg: #f0f5fa;
  --edit-bg: #e4edf5;
  --edit-border: #9eb5ce;
  --shadow: 0 1px 3px rgba(61, 106, 158, 0.1);
}
* { box-sizing: border-box; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f0f5fa;
  color: var(--text);
  line-height: 1.58;
  margin: 0;
  padding: 28px 20px 36px;
  min-height: 100vh;
}
h1 { font-size: 1.55rem; margin: 0 0 10px; font-weight: 650; letter-spacing: -0.02em; color: #2a3f54; }
.sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 26px; max-width: 58rem; }
.sub code { background: var(--pre-bg); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; border: 1px solid var(--border); }

/* 站点分页导航 */
nav.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
nav.site-nav .nav-title {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
  margin-right: 8px;
}
nav.site-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
nav.site-nav a:hover {
  color: var(--accent-hover);
  background: var(--pre-bg);
  border-color: var(--border);
}
nav.site-nav a.current {
  color: #2a4a6d;
  font-weight: 650;
  background: #d4e4f0;
  border-color: #7a9ebd;
}

main.page-wrap { max-width: 72rem; }

/* 章节页顶部：修改建议定稿说明 + 一次性复制全文（notes-persist.js） */
.catalog-notes-bar {
  font-size: 0.87rem;
  color: var(--text);
  background: #e8f0f8;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 22px;
  line-height: 1.58;
}
.catalog-notes-bar-intro {
  margin: 0 0 12px;
  color: #3d4957;
}
.catalog-notes-fs-status {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  border: 1px dashed var(--border);
  line-height: 1.5;
}
.catalog-backend-status-ok {
  color: #1a6b3c;
  border-color: #9fd4b3;
  background: #edf8f1;
}
.catalog-backend-status-warn {
  color: #8a4b00;
  border-color: #e8c88a;
  background: #fff8eb;
}

/* 每条修改建议下方的逐项保存（notes-persist.js） */
.suggestion-field-save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
}
.suggestion-save-flash {
  font-size: 0.76rem;
  color: var(--muted);
}

.catalog-notes-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 8px;
}
.catalog-notes-export-fallback summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  user-select: none;
}
.catalog-notes-export-fallback-inner {
  margin-top: 10px;
}

section { margin-bottom: 34px; }
section > h2 {
  font-size: 1.18rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 18px;
  color: #2a3f54;
  font-weight: 650;
}
article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  scroll-margin-top: 14px;
}
article h3 { margin: 0 0 8px; font-size: 1.02rem; font-weight: 650; color: #22282e; }
h3.merchant-shop-assoc-heading {
  margin: 22px 0 10px;
  font-size: 1.05rem;
  color: var(--aux-llm-title);
  font-weight: 700;
}

/* 不并入 chat system_final：单独发起的 LLM 提示（章节内卡片标题橙黄强调） */
article.aux-llm-prompt {
  border-left: 5px solid #fbbf24;
  padding-left: 17px;
  background: linear-gradient(90deg, rgba(254, 243, 199, 0.5) 0%, var(--card) 52%);
}
article.aux-llm-prompt > h3 {
  color: var(--aux-llm-title);
  font-weight: 700;
  letter-spacing: -0.015em;
}
/* 「多条独立提示」合集：折叠条标题同色 */
article.aux-llm-prompt.aux-llm-multi details.prompt-item > summary {
  color: var(--aux-llm-title);
}
article.aux-llm-prompt.aux-llm-multi details.prompt-item > summary:hover {
  color: var(--aux-llm-title-hover);
}
article.aux-llm-prompt:not(.aux-llm-multi) details.prompt-item > summary {
  color: var(--aux-llm-title);
}
article.aux-llm-prompt:not(.aux-llm-multi) details.prompt-item > summary:hover {
  color: var(--aux-llm-title-hover);
}
.section-aux-llm-catalog h2 {
  color: var(--aux-llm-title);
  border-bottom-color: #fcd34d;
}
.section-aux-llm-catalog details.prompt-item > summary {
  color: var(--aux-llm-title);
}
.section-aux-llm-catalog details.prompt-item > summary:hover {
  color: var(--aux-llm-title-hover);
}

p.aux-llm-legend {
  font-size: 0.88rem;
  color: #57534e;
  background: rgba(254, 243, 199, 0.28);
  border: 1px dashed #fbbf24;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 18px;
  max-width: 58rem;
  line-height: 1.53;
}
p.aux-llm-legend strong {
  color: var(--aux-llm-title);
}
p.aux-llm-catalog-note {
  border-left: 5px solid #fbbf24;
  padding-left: 16px;
  background: rgba(254, 243, 199, 0.3);
}
.aux-llm-method-list-hint {
  color: var(--aux-llm-title);
}

.path { font-size: 0.8rem; color: var(--muted); font-family: ui-monospace, "Cascadia Code", monospace; word-break: break-all; margin-bottom: 8px; }
.sum { margin: 0 0 10px; color: #3d444d; }
details.prompt-item { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 10px; scroll-margin-top: 14px; }
details.prompt-item:first-of-type { border-top: none; padding-top: 0; margin-top: 8px; }
details.prompt-item > pre.detail {
  margin-top: 12px;
}
summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  user-select: none;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s; flex-shrink: 0; }
details[open] summary::before { transform: rotate(90deg); }
summary:hover { color: var(--accent-hover); }
summary .summary-title-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* 每条提示词折叠行 / 单条卡片标题：是否单独配置 API_KEY（notes-persist.js） */
.catalog-api-key-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 650;
  padding: 2px 9px;
  border-radius: 999px;
  line-height: 1.35;
  white-space: nowrap;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.catalog-api-key-badge--dedicated {
  color: #14532d;
  background: #dcfce7;
  border-color: #86efac;
}
.catalog-api-key-badge--global {
  color: #57534e;
  background: #f5f5f4;
  border-color: #d6d3d1;
}
.catalog-notes-api-key-legend {
  font-size: 0.8rem;
  color: #3d4957;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  border: 1px dashed var(--border);
  line-height: 1.55;
}
.catalog-notes-api-key-legend .catalog-api-key-legend-sample {
  display: inline-flex;
  align-items: center;
  margin-left: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
  font-size: 0.7rem;
  font-weight: 650;
  padding: 2px 9px;
  border-radius: 999px;
  line-height: 1.35;
  white-space: nowrap;
  border: 1px solid transparent;
}
.catalog-api-key-legend-sample--dedicated {
  color: #14532d;
  background: #dcfce7;
  border-color: #86efac;
}
.catalog-api-key-legend-sample--global {
  color: #57534e;
  background: #f5f5f4;
  border-color: #d6d3d1;
}

.prompt-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 26%);
  gap: 8px 10px;
  margin-top: 12px;
  align-items: start;
}
@media (max-width: 960px) {
  .prompt-split { grid-template-columns: 1fr; gap: 12px; }
}
.prompt-main { min-width: 0; }
.prompt-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--edit-bg);
  border: 1px solid var(--edit-border);
  border-radius: 10px;
  padding: 8px 10px;
}
.side-label {
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.side-hint {
  font-size: 0.72rem;
  color: #8a9099;
  margin-top: 6px;
  line-height: 1.45;
}
.suggestion-field {
  flex: 1;
  width: 100%;
  min-height: 140px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.84rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  line-height: 1.55;
}
/* 与 Prompt 正文并排时：修改建议区收窄，输入框约 4 行高 */
.prompt-split .prompt-side .suggestion-field {
  flex: 0 0 auto;
  min-height: 0;
  height: calc(0.84rem * 1.55 * 4 + 22px);
  max-height: calc(0.84rem * 1.55 * 8 + 22px);
}
.suggestion-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 106, 158, 0.22);
}

/* 每条修改建议上方的可选 API_KEY（modification-notes.json 键 sugg-…__api_key） */
.suggestion-api-key-block {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.55);
}
label.suggestion-api-key-label {
  display: block;
  margin-bottom: 6px;
}
input.suggestion-api-key-field {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  line-height: 1.4;
}
input.suggestion-api-key-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 106, 158, 0.18);
}
input.suggestion-api-key-field[data-api-key-has-value="1"]:not(:focus) {
  cursor: help;
  background: #f8fafc;
}
input.suggestion-api-key-field[readonly] {
  color: var(--text);
}
.suggestion-api-key-hint {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}
.suggestion-api-key-hint code {
  font-size: 0.86em;
  background: var(--pre-bg);
  padding: 1px 4px;
  border-radius: 4px;
}

/* Prompt 正文可编辑区（catalog-prompts.js） */
.prompt-body-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
textarea.prompt-body-field {
  width: 100%;
  min-height: min(39vh, 390px);
  height: min(36vh, 360px);
  resize: vertical;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #333842;
  line-height: 1.5;
  white-space: pre-wrap;
  box-sizing: border-box;
}
.prompt-body-hint {
  margin-bottom: 6px;
}
textarea.prompt-body-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 106, 158, 0.22);
}
textarea.prompt-body-field[data-prompt-has-value="1"]:not(:focus) {
  cursor: help;
  background: #f8fafc;
}
textarea.prompt-body-field[readonly] {
  color: #333842;
  cursor: pointer;
  background: #f8fafc;
}
textarea.prompt-body-field[readonly]:hover {
  border-color: #8fa9c4;
  background: #f1f5f9;
}
.prompt-body-open-edit {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}
.prompt-body-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 4px;
}
.catalog-prompt-override-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.35;
  white-space: nowrap;
  border: 1px solid transparent;
}
.catalog-prompt-override-badge--on {
  color: #1e3a5f;
  background: #dbeafe;
  border-color: #93c5fd;
}
.catalog-prompt-override-badge--off {
  color: #57534e;
  background: #f5f5f4;
  border-color: #d6d3d1;
}

pre.detail {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  background: var(--pre-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0;
  max-height: 52vh;
  overflow: auto;
  line-height: 1.5;
  color: #333842;
}
.note { color: var(--muted); font-size: 0.86rem; margin-top: 10px; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 6px;
  background: #d4e4f0;
  color: #3d6a9e;
  border: 1px solid #8fa9c4;
  margin-right: 6px;
  vertical-align: middle;
  font-weight: 600;
}

/* 首页：按 system 注入顺序排列（替代原章节卡片） */
.catalog-system-order-intro {
  font-size: 0.93rem;
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.58;
}
ol.system-inject-order {
  list-style: none;
  counter-reset: sysinj;
  margin: 0;
  padding: 0;
  max-width: 72rem;
}
ol.system-inject-order > li {
  counter-increment: sysinj;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 6px 16px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
  align-items: start;
}
ol.system-inject-order > li:first-of-type {
  border-top: 1px dashed var(--border);
}
ol.system-inject-order > li::before {
  content: counter(sysinj, decimal-leading-zero);
  font-weight: 750;
  font-size: 0.95rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
/* 首页 system 条目主标题（与各章 h3 · summary 对齐） */
.si-title {
  font-size: 0.98rem;
  font-weight: 650;
  color: #1e293b;
  margin: 0 0 6px;
  line-height: 1.42;
}
.si-meta {
  font-size: 0.78rem;
  font-family: ui-monospace, "Cascadia Code", monospace;
  color: #5c6d7e;
  margin: 0 0 4px;
  word-break: break-all;
}
.si-desc {
  font-size: 0.9rem;
  color: #334049;
  line-height: 1.52;
  margin: 0 0 10px;
}
.si-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}
.si-links a {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
}
.si-file-ref {
  font-size: 0.82rem;
  color: var(--muted);
}
.si-file-ref a {
  color: var(--accent);
  font-weight: 600;
}

/* catalog-nav.js：首页目录跳入 + 返回链接 */
.catalog-back-to-index {
  margin: 8px 0 10px;
}
.catalog-back-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.catalog-back-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* 页脚翻页 */
nav.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 36px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  max-width: 72rem;
}
nav.pager a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}
nav.pager a:hover { text-decoration: underline; color: var(--accent-hover); }
nav.pager .pager-mid { color: var(--muted); font-size: 0.86rem; }

.notes-toolbar-btn {
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--pre-bg);
  color: var(--accent);
  font-weight: 600;
}
.notes-toolbar-btn:hover {
  background: var(--edit-bg);
  border-color: var(--edit-border);
}
.notes-toolbar-btn-primary {
  background: #3d6a9e;
  border-color: #2e557f;
  color: #fff;
}
.notes-toolbar-btn-primary:hover {
  background: #355f8f;
  border-color: #254566;
}
.notes-toolbar-btn-secondary {
  background: var(--card);
  color: var(--accent-hover);
}
.notes-toolbar-btn-secondary:hover {
  background: var(--edit-bg);
  border-color: var(--accent);
}

/* LLM catalog：工具按钮 + ADDON / 工具弹窗（catalog-modals.js） */
.catalog-tool-row {
  margin: 6px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}
button.catalog-tool-chip {
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  font-weight: 650;
}
button.catalog-tool-chip:hover {
  background: var(--pre-bg);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.catalog-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow: auto;
  box-sizing: border-box;
}
.catalog-modal-backdrop[hidden] {
  display: none !important;
}
.catalog-modal-panel {
  width: min(42rem, 100%);
  max-height: min(82vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}
.catalog-modal-head {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--card) 100%);
}
.catalog-modal-close {
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.86rem;
}
.catalog-modal-close:hover {
  background: var(--pre-bg);
}
.catalog-modal-body {
  padding: 14px 18px 18px;
  overflow: auto;
  font-size: 0.92rem;
  line-height: 1.62;
}
.catalog-modal-body .catalog-modal-h {
  margin: 0 0 10px;
  font-size: 1rem;
}
.catalog-modal-muted {
  color: var(--muted);
  font-size: 0.88rem;
}
.catalog-modal-body pre.catalog-modal-addon-body {
  margin: 10px 0 0;
  padding: 12px;
  background: var(--pre-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.84rem;
  line-height: 1.55;
}
.catalog-modal-list {
  margin: 6px 0 12px 1rem;
}
.catalog-modal-body code {
  background: var(--pre-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.86em;
  border: 1px solid var(--border);
}

/* Prompt 正文编辑弹窗（catalog-prompts.js） */
.catalog-prompt-edit-backdrop {
  align-items: center;
  padding: 1cm 16px;
  overflow: hidden;
}
.catalog-prompt-edit-backdrop .catalog-modal-panel {
  width: min(56rem, 96vw);
  height: calc(100vh - 2cm);
  height: calc(100dvh - 2cm);
  max-height: calc(100vh - 2cm);
  max-height: calc(100dvh - 2cm);
  margin: 0 auto;
}
.catalog-prompt-edit-backdrop .catalog-modal-head {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 8px;
}
.catalog-prompt-edit-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.catalog-prompt-edit-backdrop .catalog-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  flex: 1;
  min-height: 0;
}
.catalog-prompt-edit-textarea {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  resize: none;
  box-sizing: border-box;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #333842;
  white-space: pre-wrap;
}
.catalog-prompt-edit-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 106, 158, 0.22);
}
.catalog-prompt-edit-meta {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.45;
}
.catalog-prompt-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}
