/* =====================================================================
   公共零件（全站只用这一套）
   这里一个颜色值都不写：颜色、字体、圆角都来自 themes/ 里的变量。
   B 作业本在 notebook.css；A 清爽在 clean.css。换风格只改 base.html 一行。

   组件清单（和 /style 样板页一一对应）：
   面板 panel / 统计 stats stat / 状态标签 badge / 提示框 notice /
   按钮 button / 表单 form-grid form-row / 筛选 filter-tabs /
   表格 table scroll-x / 键值 kv / 标题区 eyebrow h1 lede /
   进度 progress-track progress-fill / 空状态 empty-state /
   45 格 series-grid day-card / 题目卡 item-card / 版面预览 preview-frame
   ===================================================================== */

* { box-sizing: border-box; }

html,
body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

code {
  font-family: var(--font-mono);
  font-size: .86em;
  background: var(--soft);
  padding: .1em .35em;
  border-radius: var(--r-xs);
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  color: var(--head-ink);
}
h1 { font-size: 26px; line-height: 1.35; margin: 0 0 8px; }
h2 { font-size: 18px; line-height: 1.4; margin: 0 0 14px; }
h2 small {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
h3 { font-size: 15px; line-height: 1.4; margin: 16px 0 8px; }

/* ---------------------------------------------------------------- 页面骨架 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 12px 28px;
  background: var(--topbar-bg);
  border-bottom: var(--topbar-border);
  color: var(--topbar-ink);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--topbar-ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--brand-bg);
  color: var(--brand-ink);
  border: var(--brand-border);
  font-weight: 700;
  font-size: 14px;
}
.brand-text {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: 15px;
  line-height: 1.3;
}
.brand-text small {
  display: block;
  font-family: var(--font-sans);
  color: var(--topbar-muted);
  font-weight: 400;
  font-size: 12px;
}

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  padding: 7px 12px;
  border-radius: var(--r-md);
  color: var(--topbar-muted);
  font-size: 14px;
}
.nav-link:hover { background: var(--nav-hover); color: var(--topbar-ink); text-decoration: none; }
.nav-link.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 650; }

/* 二级导航：和 /style 的筛选按钮是同一套零件，放在顶栏第二行。 */
.topbar .filter-tabs { flex: 1 1 100%; margin: 0; }

/* 页头通知位：没有提醒时整块不显示。 */
.topbar-notices { flex: 1 1 100%; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.topbar-notices a.badge:hover { text-decoration: none; }

.page { max-width: var(--page-w); margin: 0 auto; padding: 28px 28px 40px; }
.page.wide { max-width: var(--wide-w); }

.footer {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 18px 28px 34px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer a { color: var(--muted); }
.footer-links { display: inline-flex; gap: 14px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 标题区 */
.hero { padding: 8px 0 18px; }
.eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.eyebrow a { color: var(--muted); }
.lede { color: var(--muted); max-width: none; margin: 0 0 12px; font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 面板 */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin: 0 0 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--r-lg);
  padding: 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 8px 0 20px;
  align-items: start;
}
.cards .card h2 { margin-bottom: 8px; }
.cards .card p { margin: 6px 0; }
.placeholder { max-width: 760px; }

/* ---------------------------------------------------------------- 状态标签 */
.badge {
  display: inline-block;
  margin: 0;
  padding: 1px 9px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.75;
  white-space: nowrap;
}
.badge.ok,
.badge.status-green { background: var(--ok-soft); color: var(--ok); }
.badge.warn,
.badge.status-yellow { background: var(--warn-soft); color: var(--warn); }
.badge.bad,
.badge.status-red { background: var(--bad-soft); color: var(--bad); }
.badge.done,
.badge.status-confirmed { background: var(--done-soft); color: var(--done); }
.badge.soft { background: var(--soft); color: var(--muted); font-weight: 500; }
.badge.generated { background: var(--soft); color: var(--muted); }
.badge.mock { background: var(--warn-soft); color: var(--warn); }

/* ---------------------------------------------------------------- 提示框 */
.notice,
.review-flash {
  white-space: normal;
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin: 0 0 14px;
  background: var(--info-soft);
  border: 1px solid var(--info-line);
  color: var(--info-ink);
}
.notice.warn,
.review-flash.warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}
.notice.error,
.review-flash.error {
  background: var(--bad-soft);
  border-color: var(--bad-line);
  color: var(--bad);
}
.notice.ok {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice li { margin: 4px 0; }
.notice p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- 按钮 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  padding: 7px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  white-space: nowrap;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.button.secondary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 500;
}
.button.secondary:hover { background: var(--soft); border-color: var(--line); }
.button.danger {
  background: var(--panel);
  border-color: var(--bad-line);
  color: var(--bad);
  font-weight: 500;
}
.button.danger:hover { background: var(--bad-soft); }
.button.small { padding: 4px 10px; font-size: 13px; font-weight: 500; }
.button:disabled,
.button:disabled:hover {
  background: var(--soft);
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  font-weight: 500;
}
a.button { text-decoration: none; }

/* ---------------------------------------------------------------- 表单 */
input[type="number"],
input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  padding: 5px 9px;
  border: 1px solid var(--input-line);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  max-width: 100%;
}
textarea { width: 100%; min-height: 72px; resize: vertical; }
input[type="checkbox"],
input[type="radio"] { accent-color: var(--accent); }
details > summary { cursor: pointer; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  align-items: start;
}
.form-grid > div,
.form-grid > label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-grid label { font-size: 13px; color: var(--muted); font-weight: 500; }
.form-grid input,
.form-grid select,
.form-grid textarea { width: 100%; }

.form-row {
  display: flex;
  gap: 10px 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 12px 0 0;
}
.form-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form-row > .span-full { flex: 1 1 100%; }
.form-row textarea { width: 100%; }
.form-row label { font-size: 12px; color: var(--muted); }
.form-row .form-inline { display: inline-flex; gap: 6px; align-items: center; }
.form-inline input,
.form-inline select { width: auto; max-width: 180px; }
.form-row > .span-full textarea,
.form-row > .span-full input { width: 100%; }
.choice-row { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; }
.choice-row label { font-size: 14px; color: var(--ink); }
.check-line { display: flex; gap: 6px; align-items: flex-start; color: var(--ink); }
.check-line input { margin-top: 4px; }

/* ---------------------------------------------------------------- 筛选 */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 14px; }
.filter-tabs a {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
}
.filter-tabs a:hover { color: var(--ink); text-decoration: none; }
.filter-tabs a.active,
.filter-tabs a.active:hover {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

/* ---------------------------------------------------------------- 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  word-break: keep-all;
}
.table tbody tr:last-child th,
.table tbody tr:last-child td { border-bottom: 0; }
.table.definition th { width: 150px; white-space: nowrap; }
.table.definition td:nth-child(2) { width: 220px; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact { font-size: 12.5px; }
.table.compact th,
.table.compact td { padding: 5px 6px; }
.table.compact th { font-weight: 500; }
.scroll-x { overflow-x: auto; }

/* ---------------------------------------------------------------- 键值列表 */
.kv { margin: 0; display: grid; gap: 0; }
.kv > div {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; word-break: break-word; }
.kv > dt { color: var(--muted); font-size: 13px; padding-top: 6px; }
.kv > dd { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line-soft); word-break: break-word; }

/* ---------------------------------------------------------------- 统计 */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 14px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  min-width: 132px;
}
.stat strong,
.stat b {
  display: block;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.stat span { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- 进度、空状态 */
.progress-track {
  height: 8px;
  background: var(--soft);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 6px 0 10px;
}
.progress-fill { height: 8px; background: var(--accent); border-radius: var(--r-pill); }

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  color: var(--muted);
  text-align: center;
}
.empty-state p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- 45 天格子 */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin: 0;
}
.day-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px 12px;
  color: var(--ink);
  min-height: 146px;
}
.day-card:hover { border-color: var(--accent); text-decoration: none; }
.day-card .day-number {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 22px;
}
.day-card .day-title { font-weight: 650; font-size: 14px; line-height: 1.45; margin: 2px 0 4px; }
.day-card .day-meta { color: var(--muted); font-size: 12px; line-height: 1.55; }
.day-card .day-badges { margin-top: auto; padding-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.day-card.not_generated { background: var(--idle-bg); border-style: dashed; }
.day-card.not_generated .day-title { color: var(--muted); font-weight: 500; }
.day-card.not_generated .day-badges .badge { background: none; color: var(--muted); border: 1px dashed var(--line); }
.day-card.generated .day-badges .badge { background: var(--soft); color: var(--ink); }
.day-card.problem { border-color: var(--bad-line); background: var(--bad-soft); }
.day-card.problem .day-badges .badge.status-red { background: var(--panel); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-line); }
.day-card.confirmed .day-badges .badge { background: var(--done-soft); color: var(--done); }

/* ---------------------------------------------------------------- 题目卡 */
.item-card {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin: 0 0 10px;
  background: var(--panel);
}
.item-card.status-green { border-left-color: var(--ok); }
.item-card.status-yellow { border-left-color: var(--warn-bar); }
.item-card.status-red { border-left-color: var(--bad); background: var(--bad-soft); }
.item-card.status-confirmed { border-left-color: var(--done); background: var(--done-soft); }
.item-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.item-head .item-no { font-weight: 650; font-size: 13px; }
.item-head h3 { margin: 0; }
.item-summary { margin: 4px 0 8px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.item-confirm {
  margin: 4px 0 8px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: var(--done-soft);
  color: var(--done);
  font-size: 13px;
}
.item-warn {
  margin: 4px 0;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: 13px;
}
.item-block {
  margin: 4px 0;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--bad);
  font-size: 13px;
  border: 1px solid var(--bad-line);
}
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.item-actions form { margin: 0; }
.item-actions details { flex: 1 1 100%; }
.item-actions details > summary { color: var(--link); font-size: 13px; }
.item-actions button { font-size: 13px; padding: 4px 11px; }
.edit-form {
  margin-top: 7px;
  padding: 9px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--soft-2);
}
.edit-form .field-label { min-width: 92px; display: inline-block; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 检查表 */
.checks { margin-top: 6px; }
.checks > summary { color: var(--muted); font-size: 13px; }
/* 9 项检查：固定列宽，长代码（C1_answer_recompute 等）在格子里换行，
   表格不会撑出卡片（P1，2026-10-30 验收）。 */
.checks-table { table-layout: fixed; width: 100%; }
.checks-table th,
.checks-table td { overflow-wrap: anywhere; word-break: break-word; }
.checks-table th:nth-child(1),
.checks-table td:nth-child(1) { width: 38%; }
.checks-table th:nth-child(2),
.checks-table td:nth-child(2) { width: 15%; }
.checks-table th:nth-child(3),
.checks-table td:nth-child(3) { width: 15%; }
.checks-table th:nth-child(4),
.checks-table td:nth-child(4) { width: 32%; }
.check-status { font-weight: 650; white-space: nowrap; }
.check-status.ok { color: var(--ok); }
.check-status.warn { color: var(--warn); }
.check-status.fail { color: var(--bad); }
.check-status.muted { color: var(--muted); }
.finding { margin-top: 2px; }
.finding.block { color: var(--bad); }
.finding.warn { color: var(--warn-ink); }

/* ---------------------------------------------------------------- 版面预览 */
.preview-frame {
  width: 100%;
  height: 880px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--preview-bg);
}
.preview-frame.is-compact { height: 180px; }
.preview-paper {
  height: auto;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}
.preview-paper img { width: 100%; height: auto; display: block; }

.export-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.export-list li { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; background: var(--soft-2); }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; background: var(--panel); }
.history-card h3 { margin: 0 0 4px; }

pre.json {
  max-height: 300px;
  overflow: auto;
  background: var(--soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------------------------------------------------------- 小工具 */
.mono { font-family: var(--font-mono); font-size: 12px; }
.break-all { word-break: break-all; }
.wrap { white-space: normal; word-break: break-all; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.inline { display: inline; }
.actions { display: flex; flex-direction: row; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-grid > .actions { flex-direction: row; align-items: center; justify-content: flex-start; }
.actions form { margin: 0; }
.section-gap { margin-top: 18px; }
.span-full { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- /style 样板页 */
.component { margin: 0 0 28px; }
.demo {
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  margin: 8px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.demo-stack { display: block; }
.snippet {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--soft-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-size: 12px;
  white-space: pre;
  line-height: 1.55;
}
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.swatch { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--panel); }
.swatch-chip { display: block; height: 46px; border-bottom: 1px solid var(--line); }
.swatch-meta { padding: 6px 9px; font-size: 12px; line-height: 1.5; }
.swatch-meta code { background: none; padding: 0; font-size: 12px; }
.rule-list { margin: 0; padding-left: 20px; }
.rule-list li { margin: 6px 0; }

/* ---------------------------------------------------------------- 窄屏 */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .page { padding: 20px 16px 30px; }
  .footer { padding: 16px 16px 30px; }
  .table.definition th { width: auto; white-space: normal; }
  .table.definition td:nth-child(2) { width: auto; }
  .kv > div { grid-template-columns: 1fr; gap: 0; }
  .stat { min-width: 0; flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- 对话助手（WP25） */
.assistant-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.assistant-sidebar {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  padding: 12px;
  position: sticky;
  top: 16px;
}
.assistant-sidebar-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.assistant-sidebar-head h2 { margin: 0; font-size: 16px; }
.assistant-scope { margin: 6px 0; font-size: 12px; }
.conversation-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conversation-item {
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 7px 8px;
}
.conversation-item.active { border-color: var(--line); background: var(--soft); }
.conversation-title {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.conversation-title:hover { color: var(--link); }
.conversation-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.conversation-actions { margin-top: 4px; }

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chat-head h1 { margin-bottom: 2px; }
.chat-head-side { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chat-panel { padding: 12px 14px 14px; }
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 4px 4px 8px;
}
.chat-row { display: flex; }
.chat-row.user { justify-content: flex-end; }
.chat-bubble {
  max-width: min(86%, 820px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  background: var(--panel);
}
.chat-bubble.user { background: var(--info-soft); border-color: var(--info-line); }
.chat-bubble.assistant { background: var(--soft-2); }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.chat-flag {
  margin-top: 8px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-line);
  font-size: 13px;
}
.chat-tech { margin-top: 6px; font-size: 12px; color: var(--muted); }
.chat-tech summary { cursor: pointer; color: var(--link); }
.chat-detail { margin: 8px 0; border-top: 1px dashed var(--line-soft); padding-top: 6px; }
.chat-detail summary { cursor: pointer; color: var(--link); font-size: 13px; }
.chat-detail p { margin: 4px 0; font-size: 13px; }
.chat-list { margin: 4px 0 8px; padding-left: 20px; font-size: 13px; }
.chat-list li { margin: 4px 0; }
.chat-card {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  padding: 10px 12px;
}
.chat-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.chat-card-head h3 { margin: 0; font-size: 15px; }
.chat-card h4 { margin: 10px 0 4px; font-size: 13px; }
.chat-kp-list { display: flex; flex-direction: column; gap: 8px; }
.chat-kp {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  background: var(--soft-2);
}
.chat-kp-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.textbook-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.textbook-thumbs a {
  width: 150px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--soft-2);
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.textbook-thumbs img {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--line);
}
.textbook-thumbs span { display: block; padding: 4px 6px; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chat-compose { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.chat-compose label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.chat-compose textarea { width: 100%; resize: vertical; min-height: 70px; }
.chat-compose-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 6px;
}
.chat-wait {
  color: var(--warn-ink);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  font-size: 13px;
}
.chat-note { margin: 6px 0 0; font-size: 12px; }
.chat-empty { margin-top: 12px; }
.plan-lines td { vertical-align: top; }
.plan-total { margin: 8px 0; font-weight: 600; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.plan-confirm-slot:empty { display: none; }

@media (max-width: 900px) {
  .assistant-layout { grid-template-columns: 1fr; }
  .assistant-sidebar { position: static; }
  .chat-bubble { max-width: 100%; }
}

/* ================================================================
   WP27：侧边栏布局、首页 B 版、全宽页面
   颜色仍然只用 themes/ 里的变量；这里不写颜色值。
   ================================================================ */

/* 跳正文：平时藏起来，键盘聚焦时出现在左上角。 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 14px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------------------------------------------------------------- 侧边栏布局（WP27） */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w, 220px) minmax(0, 1fr);
  min-height: 100vh;
}
/* 登录页等不要导航的页面：整页给内容。 */
.app-shell.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.app-shell.no-sidebar .sidebar { display: none; }
/* 全宽页面（单天编辑、助手对话）：侧栏收起 */
.app-shell:has(.page.full-width) .sidebar { display: none; }
.app-shell:has(.page.full-width) { grid-template-columns: minmax(0, 1fr); }
.app-shell:has(.page.full-width) .footer { max-width: var(--wide-w); }

/* 内容列；页脚贴底。 */
.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* 列方向 flex 容器里的 auto margin 会让 .page 缩成内容宽度；这里撑满。 */
.main-area > .page,
.main-area > .footer { width: 100%; }
.main-area > .footer { margin-top: auto; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--topbar-bg);
  border-right: var(--topbar-border);
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: var(--topbar-bg);
  z-index: 2;
}
.sidebar-brand .brand-mark { width: 34px; height: 34px; font-size: 13px; }
.sidebar-nav { padding: 10px 8px 4px; flex: 1; }
.sidebar-section { margin-bottom: 4px; }
.sidebar-section-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px 4px;
  letter-spacing: .04em;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.sidebar-nav-item:hover { background: var(--nav-hover); color: var(--ink); text-decoration: none; }
.sidebar-nav-item.active { background: var(--soft); color: var(--ink); font-weight: 650; }
/* B 作业本：active 项左边画一根竖线 */
.sidebar-nav-item.active { border-left: 3px solid var(--accent); padding-left: 7px; }
.sidebar-nav-icon { font-size: 15px; line-height: 1; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--bad-soft);
  color: var(--bad);
  padding: 1px 6px;
  border-radius: var(--r-pill);
}
.sidebar-add-btn { margin: 6px 8px 2px; display: block; width: calc(100% - 16px); text-align: center; }
.sidebar-user {
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--muted);
}
.sidebar-user a { color: var(--muted); }
.sidebar-user a.active { color: var(--ink); font-weight: 600; }
.sidebar-user-links { display: inline-flex; gap: 4px 10px; flex-wrap: wrap; }

/* 二级入口：still 用 /style 的 filter-tabs 零件，在侧栏里改成竖排。 */
.sidebar .sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 4px;
  padding: 0 0 0 18px;
}
.sidebar .sidebar-subnav a {
  display: block;
  margin: 0;
  padding: 5px 10px;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  box-shadow: none;
}
.sidebar .sidebar-subnav a:hover { background: var(--nav-hover); color: var(--ink); text-decoration: none; }
.sidebar-section.has-active-child > .sidebar-nav-item.active { background: transparent; }
.sidebar .sidebar-subnav a.active {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
  box-shadow: none;
}

/* 全宽页面：侧栏收起后内容区最多到 1680px（--wide-w）。 */
.page.full-width { max-width: var(--wide-w); }

/* 页头通知位现在在正文顶部，不参与侧栏 sticky。 */
.topbar-notices { margin: 0 0 14px; }

/* 窄屏：侧栏折叠为顶部横向导航条（WP27 任务书 860px）。 */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: var(--topbar-border);
    padding: 0;
  }
  .sidebar-brand { border-bottom: none; padding: 10px 14px; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: visible;
    padding: 4px 6px;
    flex: 1 1 100%;
    order: 3;
  }
  .sidebar-section { display: contents; }
  .sidebar-section-label { display: none; }
  .sidebar .sidebar-subnav { display: contents; }
  .sidebar-nav-item,
  .sidebar .sidebar-subnav a {
    white-space: nowrap;
    padding: 5px 10px;
    width: auto;
    font-size: 13px;
  }
  .sidebar-nav-item.active {
    border-left: none;
    padding-left: 10px;
    box-shadow: inset 0 -2px 0 var(--ink);
    border-radius: 0;
  }
  .sidebar-section.has-active-child > .sidebar-nav-item.active {
    background: transparent;
    box-shadow: none;
  }
  .sidebar .sidebar-subnav a.active {
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--ink);
    border-radius: 0;
  }
  .sidebar-add-btn { order: 1; width: auto; margin: 6px 8px; }
  .sidebar-user { order: 2; margin-left: auto; border-top: none; padding: 6px 14px; }
  .sidebar-user-name { display: none; }
}

/* ---------------------------------------------------------------- 首页 B 版（WP27） */
.home-ask {
  background: var(--panel);
  border: var(--topbar-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin: 0 0 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.home-ask-icon { font-size: 18px; line-height: 1; padding-top: 2px; flex-shrink: 0; }
.home-ask-body { flex: 1; min-width: 0; }
.home-ask-body label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.home-ask-body textarea { min-height: 64px; }
.home-ask-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.home-ask-pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 7px 0 0; }
.home-ask .home-ask-pills button {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
}
.home-ask .home-ask-pills button:hover { background: var(--line-soft); color: var(--ink); }

.work-section { margin: 0 0 22px; }
.work-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.work-section-head h2 { margin: 0; font-size: 16px; }
.material-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.material-row:last-child { border-bottom: none; }
.material-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.material-meta { font-size: 12px; color: var(--muted); }
.material-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.material-list { padding: 0; overflow: hidden; }
.home-stat-mini { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.home-stat-mini strong { font-family: var(--font-num); font-size: 22px; font-weight: 700; color: var(--ink); }
.home-stat-mini span { font-size: 13px; color: var(--muted); }
.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.home-empty { margin: 0; }
.home-guide { padding: 22px 24px; }
.home-guide h2 { margin-bottom: 8px; }
.home-guide-steps { margin: 8px 0 16px; padding-left: 22px; }
.home-guide-steps li { margin: 7px 0; }
.home-guide-steps b { color: var(--ink); }

.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.recent-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--panel);
}
.recent-card h3 { margin: 0 0 4px; font-size: 15px; }
.recent-meta { color: var(--muted); font-size: 12px; }
.recent-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }

/* “我的资料”列表：7 列固定比例，资料类型/天数/状态不拆行。 */
.series-table { table-layout: fixed; width: 100%; }
.series-table th,
.series-table td { overflow-wrap: break-word; word-break: normal; }
.series-table th:nth-child(1), .series-table td:nth-child(1) { width: 28%; }
.series-table th:nth-child(2), .series-table td:nth-child(2) { width: 11%; white-space: nowrap; }
.series-table th:nth-child(3), .series-table td:nth-child(3) { width: 24%; }
.series-table th:nth-child(4), .series-table td:nth-child(4) { width: 12%; }
.series-table th:nth-child(5), .series-table td:nth-child(5) { width: 8%; white-space: nowrap; }
.series-table th:nth-child(6), .series-table td:nth-child(6) { width: 9%; }
.series-table th:nth-child(7), .series-table td:nth-child(7) { width: 8%; white-space: nowrap; }
