:root {
  --bg: #f6f8f4;
  --panel: #ffffff;
  --ink: #16211b;
  --ink-2: #5a6b61;
  --ink-3: #90a096;
  --line: #e3eae2;
  --brand: #2e6b4c;
  --brand-2: #3e8a63;
  --brand-soft: #eaf3ed;
  --gold: #a9761f;
  --shadow: 0 1px 2px rgba(20, 40, 30, 0.04), 0 10px 28px rgba(20, 40, 30, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 布局 ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 14px;
  flex-wrap: wrap;
}

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

.logo {
  width: 66px; height: 66px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(46, 107, 76, 0.25);
  flex-shrink: 0;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

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

.stat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.stat-chip b { color: var(--brand); font-weight: 650; }

/* 原生 select 仅作状态源（模型数据与 change 事件），视觉由 .model-picker 承担 */
.model-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- 主体 ---------- */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  min-height: 0;
  padding-bottom: 8px;
}

.chat-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 8px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: #d5ded4; border-radius: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }

/* 欢迎区 */
.welcome { padding: 14px 0 6px; }
.welcome h2 {
  font-size: 22px;
  margin: 0 0 8px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.welcome .lead {
  color: var(--ink-2);
  font-size: 14px;
  margin: 0 0 20px;
  max-width: 620px;
}
.suggest-label {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 10px;
  letter-spacing: 0.4px;
}
.suggests { display: flex; flex-wrap: wrap; gap: 9px; }

.suggest {
  border: 1px solid var(--line);
  background: #fbfcfa;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
}
.suggest:hover {
  border-color: var(--brand-2);
  background: var(--brand-soft);
  color: var(--brand);
}
.suggest .cat-tag {
  color: var(--ink-3);
  font-size: 11.5px;
  margin-right: 6px;
}
.suggest:hover .cat-tag { color: var(--brand-2); }

/* ---------- 消息 ---------- */
.msg { margin-bottom: 20px; display: flex; gap: 11px; }
.msg.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 15px; flex-shrink: 0;
  margin-top: 2px;
}
.msg.assistant .avatar { background: var(--brand-soft); color: var(--brand); }
.msg.user .avatar { background: #eef1ee; color: var(--ink-2); }

.bubble {
  max-width: 84%;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14.5px;
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant .bubble {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h4 { margin: 14px 0 7px; font-size: 14.5px; color: var(--brand); }
.bubble h4:first-child { margin-top: 0; }
.bubble ul, .bubble ol { margin: 6px 0 9px; padding-left: 21px; }
.bubble li { margin-bottom: 4px; }
.bubble strong { color: var(--brand); font-weight: 650; }
.msg.user .bubble strong { color: #fff; }
.bubble code {
  background: #eef2ec; padding: 1px 5px; border-radius: 4px;
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #2b4a3a;
}

/* 引用来源 */
.refs { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line); }
.refs-title {
  font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.5px; margin-bottom: 7px;
}
.ref-card {
  background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--brand-2);
  border-radius: 8px; padding: 8px 11px; margin-bottom: 6px;
}
.ref-card .r-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.ref-card .r-src { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.55; }
.ref-cat {
  display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); margin-right: 6px;
  vertical-align: 1px;
}

/* 状态行 */
.status-line {
  font-size: 12.5px; color: var(--ink-3);
  display: flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.dots { display: inline-flex; gap: 3px; }
.dots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--brand-2);
  animation: blink 1.1s infinite ease-in-out;
}
.dots i:nth-child(2) { animation-delay: 0.18s; }
.dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.cursor {
  display: inline-block; width: 7px; height: 15px; background: var(--brand-2);
  vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite;
}

.err-box {
  background: #fdf4f2; border: 1px solid #f2d7cf; color: #a4442c;
  border-radius: 9px; padding: 10px 13px; font-size: 13.5px;
}

/* ---------- 输入区 ---------- */
.composer { border-top: 1px solid var(--line); padding: 13px 18px 15px; background: #fdfefd; }

.composer-inner {
  display: flex; gap: 10px; align-items: flex-end;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 8px 8px 14px; background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.composer-inner:focus-within {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(62, 138, 99, 0.1);
}

#input {
  flex: 1; border: none; outline: none; resize: none;
  font-family: inherit; font-size: 14.5px; line-height: 1.65;
  color: var(--ink); background: transparent;
  max-height: 132px; padding: 6px 0;
}
#input::placeholder { color: var(--ink-3); }

.send-btn {
  border: none; border-radius: 9px; padding: 9px 18px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 550;
  font-family: inherit; cursor: pointer; transition: background 0.16s ease;
  flex-shrink: 0;
}
.send-btn:hover:not(:disabled) { background: var(--brand-2); }
.send-btn:disabled { background: #c8d3c9; cursor: not-allowed; }

.stop-btn {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 16px;
  background: #fff; color: var(--ink-2); font-size: 14px;
  font-family: inherit; cursor: pointer; flex-shrink: 0;
}
.stop-btn:hover { border-color: #d8a99c; color: #a4442c; }

.composer-tip {
  font-size: 11.5px; color: var(--ink-3); margin-top: 8px; text-align: center;
}

/* ---------- 侧栏 ---------- */
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; padding-bottom: 4px; }
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: #dde4dc; border-radius: 3px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 16px;
}
.card h3 {
  margin: 0 0 12px; font-size: 13px; font-weight: 650;
  color: var(--ink); letter-spacing: 0.3px;
  display: flex; align-items: center; justify-content: space-between;
}
.card h3 span { font-size: 11px; color: var(--ink-3); font-weight: 400; }

.cat-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; padding: 5px 0;
  border-bottom: 1px solid #f2f5f1;
}
.cat-row:last-child { border-bottom: none; }
.cat-row .c-name { color: var(--ink-2); }
.cat-row .c-num { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat-bar { height: 3px; background: var(--brand-soft); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.cat-bar i { display: block; height: 100%; background: var(--brand-2); }

.recent-item {
  font-size: 12.5px; color: var(--ink-2); padding: 6px 0;
  border-bottom: 1px solid #f2f5f1; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; cursor: pointer;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { color: var(--brand); }
.empty-hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }

.footnote {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  padding: 6px 0 2px;
}
.copyright {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  padding: 2px 0 14px;
  letter-spacing: 0.3px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .app { padding: 0 12px; }
  .bubble { max-width: 92%; }
}

/* ==================================================================
   知识库管理后台（admin.js）
   ================================================================== */
.src-tag {
  font-style: normal;
  font-size: 11px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--brand-soft);
  color: var(--brand);
  vertical-align: 1px;
}

.admin-entry {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
}
.admin-entry:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
a.admin-entry { text-decoration: none; display: inline-flex; align-items: center; }

.admin-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 32, 25, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 999;
}
.admin-mask[hidden] { display: none; }

.admin-panel {
  width: 100%;
  max-width: 1000px;
  height: 100%;
  max-height: 880px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(16, 40, 28, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfb, #f5f9f5);
  flex-wrap: wrap;
}
.admin-head-left h2 { margin: 0; font-size: 16px; font-weight: 650; }
.admin-head-left p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.admin-head-right { display: flex; align-items: center; gap: 10px; }
.ad-user { font-size: 12.5px; color: var(--ink-2); }

.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 28px;
}

/* ---------- 通用控件 ---------- */
.ad-btn {
  font: inherit;
  font-size: 13px;
  padding: 8px 15px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ad-btn:hover:not(:disabled) { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.ad-btn:disabled { opacity: .55; cursor: not-allowed; }
.ad-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ad-btn-primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.ad-btn-ghost { background: transparent; }
.ad-btn-sm { font-size: 12px; padding: 5px 11px; border-radius: 7px; }
.ad-btn-danger { color: #b23a3a; }
.ad-btn-danger:hover:not(:disabled) { border-color: #d97b7b; color: #b23a3a; background: #fdf2f2; }

.ad-input {
  font: inherit;
  font-size: 13.5px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.ad-input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(62, 138, 99, 0.1); }
.ad-input[readonly] { background: #f5f7f5; color: var(--ink-3); }
.ad-textarea { min-height: 220px; line-height: 1.75; resize: vertical; font-size: 13.5px; }
.ad-textarea-sm { min-height: 62px; resize: vertical; }

.ad-field { margin-bottom: 14px; }
.ad-field > label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.ad-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.6; }
.ad-inline { display: flex; gap: 8px; }
.ad-inline .ad-input { flex: 1; }
.ad-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.ad-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.ad-form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- 提示条 ---------- */
.ad-notice {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid;
}
.ad-notice-ok { background: #f1f8f3; border-color: #cfe6d8; color: #2b6349; }
.ad-notice-err { background: #fdf3f2; border-color: #f0d3d0; color: #a8382f; }

/* ---------- 登录 ---------- */
.ad-auth { max-width: 460px; margin: 24px auto 0; }
.ad-auth-tip {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--brand-soft);
  border-radius: 10px;
  padding: 12px 15px;
  margin-bottom: 20px;
  line-height: 1.75;
}
.ad-auth-links { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; }
.ad-auth-links a { color: var(--brand); text-decoration: none; }
.ad-auth-links a:hover { text-decoration: underline; }
.ad-auth-note { font-size: 12px; color: var(--ink-3); margin-top: 12px; line-height: 1.7; }

/* ---------- 列表 ---------- */
.ad-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.ad-search { flex: 1; min-width: 180px; }
.ad-select { flex: 0 0 150px; width: 150px; }

.ad-stats {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ad-stats b { color: var(--brand); }

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

.ad-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 15px;
  background: #fff;
  transition: border-color .15s;
}
.ad-item:hover { border-color: #cfdcd4; }
.ad-item-off { opacity: .6; background: #fafbfa; }

.ad-item-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 7px; }
.ad-cat {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}
.ad-item-title { font-size: 14px; font-weight: 550; color: var(--ink); flex: 1; min-width: 180px; }
.ad-item-id { font-size: 11.5px; color: var(--ink-3); font-family: ui-monospace, Menlo, monospace; }
.ad-off-tag { font-size: 11px; padding: 2px 7px; border-radius: 20px; background: #f1eee9; color: #8a7a63; }

.ad-item-kw { font-size: 12px; color: var(--ink-2); margin-bottom: 5px; line-height: 1.65; }
.ad-item-body { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; margin-bottom: 5px; }
.ad-item-src { font-size: 11.5px; color: var(--ink-3); font-style: italic; }
.ad-item-actions { display: flex; gap: 8px; margin-top: 11px; }

.ad-empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  padding: 40px 20px;
  line-height: 1.9;
}

/* ---------- 编辑 ---------- */
.ad-edit { max-width: 760px; }
.ad-edit-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.ad-edit-title { font-size: 14px; font-weight: 550; color: var(--ink-2); }
.ad-form-wide .ad-input { font-size: 14px; }

@media (max-width: 720px) {
  .admin-mask { padding: 0; }
  .admin-panel { max-height: none; border-radius: 0; }
  .ad-grid2 { grid-template-columns: 1fr; }
  .ad-select { flex: 1 1 100%; width: 100%; }
}

/* ==================================================================
   知识库每周更新（changelog.js）
   ================================================================== */
.weekly-entry { display: inline-flex; align-items: center; gap: 7px; }
.weekly-dot {
  font-style: normal;
  font-size: 10.5px;
  line-height: 1;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.weekly-entry:hover .weekly-dot { background: var(--brand-2); box-shadow: none; }

.weekly-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(18, 32, 25, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-tap-highlight-color: transparent;
}
.weekly-mask[hidden] { display: none; }

.weekly-panel {
  width: 100%;
  max-width: 780px;
  max-height: 86vh;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(16, 40, 28, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.weekly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfb, #f5f9f5);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.weekly-head-left { flex: 1 1 0; min-width: 0; }
.weekly-head .ad-btn { flex-shrink: 0; }
.weekly-head-left h2 { margin: 0; font-size: 16px; font-weight: 650; }
.weekly-head-left p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); }
.weekly-head-left p b { color: var(--brand); font-weight: 650; }

.weekly-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.weekly-foot {
  flex-shrink: 0;
  padding: 9px 20px 12px;
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: center;
  border-top: 1px solid var(--line);
  line-height: 1.6;
}

/* ---------- 周卡片 ---------- */
.wk-week {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fff;
  overflow: hidden;
}
.wk-week-head {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #fbfdfb;
  border: 0;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.wk-week-head:hover { background: var(--brand-soft); }
.wk-week-date {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.wk-week-date i { font-style: normal; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.wk-week-meta {
  font-size: 12px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.wk-week-meta b { color: var(--brand); font-weight: 650; }
.wk-caret {
  font-style: normal;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  transition: transform .18s;
  display: inline-block;
}
.wk-week.wk-open .wk-caret { transform: rotate(90deg); }

.wk-week-body { display: none; padding: 0 14px 12px; }
.wk-week.wk-open .wk-week-body { display: block; }

.wk-note {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
  margin: 10px 0 9px;
  padding: 8px 11px;
  background: var(--brand-soft);
  border-radius: 8px;
}
.wk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wk-chip {
  font-size: 11px;
  color: var(--brand);
  background: #f2f8f4;
  border: 1px solid #dcebe1;
  border-radius: 999px;
  padding: 1px 8px;
}

.wk-list { list-style: none; margin: 0; padding: 0; }
.wk-item {
  display: grid;
  grid-template-columns: 42px 50px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #eef3ef;
  font-size: 13px;
  line-height: 1.6;
}
.wk-item:last-child { border-bottom: none; }
.wk-badge {
  font-size: 10.5px;
  text-align: center;
  padding: 1px 0;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 500;
}
.wk-badge-upd { background: #fdf4e6; color: var(--gold); }
.wk-id {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  color: var(--ink-3);
  padding-top: 1px;
}
.wk-title { color: var(--ink); word-break: break-word; }
.wk-cat {
  font-size: 10.5px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  justify-self: end;
}

/* ==================================================================
   每周更新 + 顶栏 移动端适配
   ================================================================== */
@media (max-width: 720px) {
  .topbar { padding: 12px 0 10px; gap: 10px; }
  .logo { width: 52px; height: 52px; }
  .brand { gap: 10px; }
  .brand h1 { font-size: 15.5px; }
  .brand p { font-size: 11.5px; line-height: 1.55; }
  .topbar-right { gap: 8px; width: 100%; }
  .stat-chip { font-size: 11.5px; padding: 5px 10px; }
  .admin-entry { font-size: 12px; padding: 6px 11px; }
  .weekly-entry { flex: 1 1 auto; justify-content: center; }

  .weekly-mask { padding: 0; align-items: stretch; }
  .weekly-panel { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .weekly-head { padding: 12px 14px; gap: 8px; align-items: flex-start; }
  .weekly-head-left h2 { font-size: 15px; }
  .weekly-head-left p { font-size: 12px; line-height: 1.6; }
  .weekly-body { padding: 12px 12px 6px; }
  .weekly-foot { padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); font-size: 11px; }
  .wk-week { border-radius: 10px; margin-bottom: 10px; }
  .wk-week-head { padding: 11px 12px; align-items: flex-start; gap: 8px; }
  .wk-week-date { font-size: 13px; flex-direction: column; gap: 1px; }
  .wk-week-date i { font-size: 11px; }
  .wk-week-meta { font-size: 11.5px; gap: 5px; padding-top: 1px; }
  .wk-week-body { padding: 0 12px 10px; }
  .wk-note { font-size: 12px; padding: 7px 10px; margin: 9px 0 8px; }
  .wk-item {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 2px 8px;
    padding: 9px 0;
    font-size: 12.5px;
  }
  .wk-badge { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
  .wk-id { grid-column: 2; font-size: 11px; padding-top: 0; }
  .wk-title { grid-column: 2; }
  .wk-cat { grid-column: 2; justify-self: start; margin-top: 2px; }
}

@media (max-width: 400px) {
  .brand h1 { font-size: 14.5px; }
  .brand p { display: none; }
  .stat-chip { font-size: 11px; padding: 4px 9px; }
  .admin-entry { font-size: 11.5px; padding: 5px 10px; }
  .wk-item { font-size: 12px; }
}

/* ---------- 版本号徽标 ---------- */
.ver-badge {
  display: inline-block;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #d8e9de;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 7px;
  vertical-align: 2px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* 每周更新面板里的批次版本号 */
.wk-ver {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 0 6px;
  font-style: normal;
}

@media (max-width: 720px) {
  .ver-badge { font-size: 10.5px; padding: 1px 7px; margin-left: 5px; vertical-align: 1px; }
}

/* ==================================================================
   模型选择器（modelpicker.js）
   ================================================================== */
.model-picker { position: relative; display: inline-flex; }

.mp-trigger {
  font: inherit;
  font-size: 12.5px;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  max-width: 210px;
  transition: border-color .15s, color .15s, background .15s;
}
.mp-trigger:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.mp-trigger:focus-visible { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(62, 138, 99, 0.14); }
.mp-trigger[aria-expanded="true"] { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.mp-trigger.mp-disabled { opacity: .55; cursor: not-allowed; }

.mp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-2);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(62, 138, 99, 0.12);
}
.mp-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.mp-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: .55;
  flex-shrink: 0;
  transition: transform .18s;
  margin-top: 1px;
}
.mp-trigger[aria-expanded="true"] .mp-caret { transform: rotate(180deg); }

/* ---------- 下拉面板 ---------- */
.mp-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: min(420px, calc(100vh - 180px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 16px 40px rgba(16, 40, 28, 0.16), 0 2px 6px rgba(16, 40, 28, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mp-in .14s ease-out;
}
.mp-menu[hidden] { display: none; }
@keyframes mp-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.mp-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfb;
  flex-shrink: 0;
}
.mp-search-icon { width: 15px; height: 15px; color: var(--ink-3); flex-shrink: 0; }
.mp-search input {
  font: inherit;
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  padding: 2px 0;
}
.mp-search input::placeholder { color: var(--ink-3); }

.mp-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.mp-group + .mp-group { margin-top: 2px; }
.mp-group-title {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .4px;
  color: var(--ink-3);
  padding: 8px 8px 4px;
  text-transform: uppercase;
}

.mp-option {
  font: inherit;
  width: 100%;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  transition: background .12s;
}
.mp-option:hover, .mp-option.mp-active { background: #f2f8f4; }
.mp-option.mp-selected { background: var(--brand-soft); color: var(--brand); font-weight: 550; }
.mp-option.mp-selected.mp-active { background: #e2efe7; }

.mp-check { font-size: 12px; color: var(--brand-2); text-align: center; line-height: 1; }
.mp-opt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-width: 0; }
.mp-opt-right { display: inline-flex; min-width: 0; justify-self: end; }
.mp-opt-id {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  max-width: 120px;
  text-overflow: ellipsis;
}
/* 选中行不显示 id（当前模型已展示在顶部按钮上），把空间留给名称与推荐标 */
.mp-option.mp-selected .mp-opt-right { display: none; }
.mp-option.mp-selected .mp-opt-id { color: #7aa88f; }
.mp-rec {
  font-style: normal;
  font-size: 9.5px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--gold);
  background: #fdf4e6;
  border-radius: 4px;
  padding: 0 5px;
  flex-shrink: 0;
}
.mp-empty { padding: 26px 12px; text-align: center; font-size: 12.5px; color: var(--ink-3); }

.mp-scrim { position: fixed; inset: 0; background: rgba(18, 32, 25, .34); z-index: 79; }
.mp-scrim[hidden] { display: none; }

/* ==================================================================
   模型选择器 · 移动端（底部抽屉）
   ================================================================== */
@media (max-width: 720px) {
  .model-picker { flex: 1 1 100%; width: 100%; }

  .mp-trigger {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    font-size: 13px;
    padding: 10px 13px;
    border-radius: 12px;
    min-height: 42px;
  }
  .mp-trigger .mp-caret { margin-left: auto; }
  .mp-label { flex: 1; }

  .mp-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-width: none;
    max-height: 76vh;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: mp-sheet-in .2s cubic-bezier(.22, .61, .36, 1);
    z-index: 900;
  }
  @keyframes mp-sheet-in {
    from { transform: translateY(14%); opacity: .6; }
    to { transform: translateY(0); opacity: 1; }
  }
  .mp-menu::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #d8e2db;
    margin: 9px auto 2px;
    flex-shrink: 0;
  }
  .mp-search { padding: 8px 14px 10px; }
  .mp-search input { font-size: 14px; }
  .mp-search-icon { width: 16px; height: 16px; }
  .mp-list { padding: 4px 8px 12px; }
  .mp-group-title { font-size: 11px; padding: 10px 8px 6px; }
  .mp-option {
    min-height: 46px;
    font-size: 14px;
    padding: 10px 10px;
    border-radius: 10px;
    grid-template-columns: 18px minmax(0, 1fr);
  }
  .mp-opt-id { display: none; }
  .mp-check { font-size: 13px; }
  .mp-scrim { z-index: 890; }

  body.mp-lock { overflow: hidden; }
}

/* hidden 属性优先级兜底（元素自带 display 时 hidden 会失效） */
[hidden] { display: none !important; }
