/*
 * BeckyBot 网页版。配色和手机版 BeckyPalette 一致(暖白底、墨色字、没有蓝紫)。
 *
 * 布局:
 *   ≥1100px  三栏:项目和聊天 | 聊天 | 项目面板(可收起)
 *   760–1099 两栏:项目和聊天 | 聊天;项目面板从右边滑出
 *   <760     只有聊天;左栏和项目面板都是抽屉
 *
 * 这份样式表是整份重写的(2026-10-05),之前四五层规则互相覆盖,三栏布局被最后一层
 * 「display:block + 抽屉」盖掉了。改的时候按区块找,别再往文件末尾追加覆盖层。
 */

:root {
  color-scheme: light;
  --bg: #faf9f7;
  --surface: #f1eee9;
  --elevated: #ffffff;
  --line: #e6e1d9;
  --ink: #3d3929;
  --ink-2: #7d786d;
  --ink-3: #a8a29a;
  --user-bubble: #e7e4de;
  --code-bg: #f4f1ec;
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.1);
  --danger: #b03a2e;
  --hover: rgba(61, 57, 41, 0.06);
  --active: rgba(61, 57, 41, 0.1);
  --shadow: 0 12px 32px rgba(61, 57, 41, 0.12);
  --rail-width: 272px;
  --context-width: 340px;
  --content-width: 760px;
  --composer-list-padding: 104px;
  --composer-translate-y: 0px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

body.is-authenticated {
  overflow: hidden;
}

button,
textarea,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--accent);
}

svg {
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.small-note {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.45;
}

.kicker {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--hover);
  color: var(--ink);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-command {
  border: 0;
  padding: 3px 6px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.text-command:hover {
  background: var(--hover);
  color: var(--ink);
}

.danger-command {
  color: var(--danger);
}

.danger-command:hover {
  color: var(--danger);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}

/* ---------- 登录 ---------- */

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .login-screen {
  display: none;
}

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-panel {
  width: min(380px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--elevated);
  box-shadow: var(--shadow);
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13px;
}

.login-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  font-size: 16px;
}

.login-panel input:focus {
  outline: none;
  border-color: var(--ink-3);
}

.login-panel button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-lockup > div:last-child {
  display: grid;
  min-width: 0;
}

.brand-lockup strong {
  font-size: 15px;
}

.brand-lockup span {
  color: var(--ink-3);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

/* ---------- 外壳 ---------- */

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr) var(--context-width);
  overflow: hidden;
}

body.context-collapsed .app-shell {
  grid-template-columns: var(--rail-width) minmax(0, 1fr) 0;
}

body.context-collapsed .context-column {
  visibility: hidden;
}

.sidebar-scrim {
  display: none;
}

/* 默认项目的聊天、设置页:没有右侧栏。 */
body.no-context .app-shell {
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
}

body.no-context .context-column {
  display: none;
}

.sidebar-open-button,
.sidebar-close-button {
  display: none;
}

/* ---------- 左栏:项目和聊天 ---------- */

.project-rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.rail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

/* 新聊天:整行、显眼,和 ChatGPT 左上角那个一样的位置。 */
.new-chat-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--elevated);
  font-size: 14px;
  font-weight: 600;
}

.new-chat-button:hover {
  border-color: var(--ink-3);
}

.new-chat-button svg,
.user-summary svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 项目和聊天放在同一个滚动区里:各自再套一层滚动条在窄的左栏里很难用。 */
.rail-scroll {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.rail-section {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.rail-section-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rail-section.collapsed .project-list,
.rail-section.collapsed .rail-section-body {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 2px;
}

.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.section-toggle:hover {
  background: var(--hover);
  color: var(--ink-2);
}

.section-caret {
  display: inline-block;
  width: 10px;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.rail-section.collapsed .section-caret {
  transform: none;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-command {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
}

.mini-command:hover {
  background: var(--active);
  color: var(--ink);
}

.project-list {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.project-group-heading {
  padding: 6px 8px 2px;
  color: var(--ink-3);
  font-size: 11px;
}

.project-button,
.window-button,
.assistant-entry {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.project-button:hover,
.window-button:hover,
.assistant-entry:hover {
  background: var(--hover);
}

.project-button.active,
.window-row.active .window-button {
  background: var(--active);
}

.project-title,
.window-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.project-button.active .project-title,
.window-row.active .window-title {
  font-weight: 600;
}

.project-meta {
  flex: none;
  color: var(--ink-3);
  font-size: 11.5px;
}

.assistant-entry {
  font-size: 14px;
}

.assistant-entry .status-pill {
  background: var(--accent);
  color: #fff;
}

.window-list {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.window-button {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}

.window-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.3;
}

.window-row {
  position: relative;
  min-width: 0;
}

/* 栅格的列默认按内容撑开,长标题会把整个左栏撑出横向滚动条;钉死成可用宽度。 */
.rail-scroll,
.rail-section,
.rail-section-body,
.project-list,
.window-list {
  grid-template-columns: minmax(0, 1fr);
}

.project-button,
.window-button {
  min-width: 0;
  overflow: hidden;
}

.window-row.active .window-button {
  padding-right: 34px;
}

.window-menu-button {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 26px;
  height: 26px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
}

.window-menu-button:hover {
  background: var(--active);
  color: var(--ink);
}

.window-menu {
  position: absolute;
  top: calc(100% + 2px);
  right: 4px;
  z-index: 20;
  display: grid;
  min-width: 120px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--elevated);
  box-shadow: var(--shadow);
}

.window-menu button {
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
}

.window-menu button:hover {
  background: var(--hover);
}

.window-menu .danger {
  color: var(--danger);
}

.sidebar-footer {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* 底部只留用户名,点它进设置;退出登录放在设置页最下面。 */
.user-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
}

.user-summary:hover {
  background: var(--hover);
  color: var(--ink);
}

.user-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.user-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- 中栏:聊天 ---------- */

.chat-column {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 16px 8px 24px;
  border-bottom: 1px solid var(--line);
}

.chat-title-block {
  flex: 1;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  gap: 6px;
  color: var(--ink-3);
  font-size: 12px;
}

.chat-title-block h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.header-subtitle {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

.header-subtitle:empty {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.model-picker select {
  max-width: 220px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--elevated);
  font-size: 13px;
}

.hidden-control {
  display: none !important;
}

.message-stage {
  position: relative;
  min-height: 0;
  display: grid;
}

.message-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px max(24px, calc((100% - var(--content-width)) / 2)) 32px;
}

.sticky-question {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 7px max(24px, calc((100% - var(--content-width)) / 2));
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 247, 0.96);
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 13px;
}

.sticky-question:hover {
  color: var(--ink);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--ink-2);
  text-align: center;
}

.chat-empty strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

/* 消息:回答不套气泡,问题是右侧浅灰气泡,和手机一样。 */

.message {
  margin: 0 0 22px;
}

.message.user {
  display: grid;
  justify-items: end;
}

.message.user .message-body {
  max-width: min(78%, 620px);
  padding: 9px 14px;
  border-radius: 18px;
  background: var(--user-bubble);
  white-space: normal;
  overflow-wrap: anywhere;
}

.message.notice .message-body {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
}

.message.notice.error .message-body {
  color: var(--danger);
}

.message.pending .message-body {
  color: var(--ink-2);
}

.hashtag {
  color: var(--accent);
}

.message-body {
  overflow-wrap: anywhere;
}

.message-body > :first-child {
  margin-top: 0;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.message-body p {
  margin: 0 0 0.75em;
}

.message-body h3,
.message-body h4,
.message-body h5,
.message-body h6 {
  margin: 1.1em 0 0.5em;
  line-height: 1.35;
}

.message-body h3 {
  font-size: 1.2em;
}

.message-body h4 {
  font-size: 1.08em;
}

.message-body h5,
.message-body h6 {
  font-size: 1em;
}

.message-body ul,
.message-body ol {
  margin: 0 0 0.75em;
  padding-left: 1.5em;
}

.message-body li {
  margin: 0.2em 0;
}

.message-body li > ul,
.message-body li > ol {
  margin: 0.2em 0 0;
}

.message-body blockquote {
  margin: 0 0 0.75em;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line);
  color: var(--ink-2);
}

.message-body hr {
  margin: 1em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.message-body code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.message-body pre {
  position: relative;
  margin: 0 0 0.75em;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--code-bg);
  overflow-x: auto;
}

.message-body pre code {
  padding: 0;
  background: none;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.code-lang {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.table-wrap {
  margin: 0 0 0.75em;
  overflow-x: auto;
}

.message-body table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 14px;
}

.message-body th,
.message-body td {
  padding: 7px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.message-body th {
  background: var(--surface);
  font-weight: 600;
}

.message-body img {
  max-width: 100%;
  border-radius: 10px;
}

.md-image {
  display: inline-block;
}

.md-image img {
  max-height: 360px;
  border: 1px solid var(--line);
}

/* 附件 */

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 6px;
}

.msg-attachment.image img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.msg-attachment.file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
  color: var(--ink);
  text-decoration: none;
}

.msg-attachment-ic {
  display: grid;
  color: var(--ink-2);
}

.msg-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

/* 来源、话题、操作 */

.citations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.citations-label {
  color: var(--ink-3);
  font-size: 12px;
}

.citation {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 260px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--elevated);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.citation:hover {
  border-color: var(--ink-3);
}

.citation-marker {
  color: var(--ink-3);
  font-size: 11px;
}

.topic-slot:empty {
  display: none;
}

.topic-slot {
  margin-top: 8px;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
}

button.topic-tag:hover {
  background: var(--active);
  color: var(--ink);
}

.topic-tag.pending {
  color: var(--ink-3);
}

.message-actions {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  margin-left: -6px;
}

.message-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
}

.message-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-action:hover {
  background: var(--hover);
  color: var(--ink);
}

.message-action.active,
.message-action.copied,
.message-action.loading {
  color: var(--accent);
}

.message-action.loading svg {
  animation: pulse-icon 0.9s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

/* 产出物卡片 / 待办卡片 */

.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 420px);
  margin: 4px 0 0.75em;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
  text-align: left;
}

.doc-card:hover {
  border-color: var(--ink-3);
}

.doc-card-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
}

.doc-card-text {
  display: grid;
  min-width: 0;
}

.doc-card-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.doc-card-text span {
  color: var(--ink-2);
  font-size: 12.5px;
}

/* 表格卡片:左边点开预览,右边下载。 */
.sheet-card {
  justify-content: space-between;
  padding-right: 10px;
}

.sheet-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.sheet-card-main:hover strong {
  text-decoration: underline;
}

button.msg-attachment.file {
  font: inherit;
  cursor: pointer;
}

.detail-dialog.wide {
  width: min(1200px, calc(100vw - 32px));
}

.sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.sheet-tab {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--elevated);
  font-size: 13px;
}

.sheet-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.sheet-preview {
  max-height: 64vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--elevated);
}

.message-body .sheet-preview table {
  min-width: 0;
  font-size: 13px;
}

.message-body .sheet-preview th,
.message-body .sheet-preview td {
  max-width: 320px;
  padding: 5px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-body .sheet-preview thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--ink-2);
  font-weight: 500;
  text-align: center;
}

.message-body .sheet-preview tbody th {
  position: sticky;
  left: 0;
  background: var(--surface);
  color: var(--ink-3);
  font-weight: 400;
  text-align: right;
}

.todo-card {
  width: min(100%, 520px);
  margin: 4px 0 0.75em;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
}

.message-body .todo-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.message-body .todo-card ul ul {
  padding-left: 24px;
}

.todo-card-item {
  margin: 0;
}

.todo-card-item > label {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
}

.todo-card-item.done > label span {
  color: var(--ink-3);
  text-decoration: line-through;
}

.todo-card-more {
  padding: 4px 0 2px 24px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.todo-due {
  margin-left: 8px;
  color: var(--ink-3);
  font-size: 12px;
}

input[type="checkbox"] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--ink);
}

/* 「思考中」的动画 */

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.thinking-label {
  animation: thinking-breathe 1.4s ease-in-out infinite;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: thinking-bounce 1.4s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking-bounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes thinking-breathe {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-label,
  .thinking-dots i,
  .message-action.loading svg,
  .attachment-state.uploading {
    animation: none;
  }
}

/* ---------- 输入框 ---------- */
/* 一行三格:+ | 输入 | 发送,上下居中。附件和 # 选话题在它上面。 */

.composer {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "atts atts atts"
    "attach input send";
  align-items: end;
  column-gap: 6px;
  width: min(var(--content-width), calc(100% - 48px));
  margin: 0 auto 16px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--elevated);
  box-shadow: 0 2px 10px rgba(61, 57, 41, 0.05);
}

.composer:focus-within {
  border-color: var(--ink-3);
}

.composer textarea {
  grid-area: input;
  display: block;
  width: 100%;
  min-height: 36px;
  max-height: 150px;
  margin: 0;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  overflow-y: auto;
  font-size: 15px;
  line-height: 22px;
}

.composer textarea::placeholder {
  color: var(--ink-3);
}

.composer-attach,
#composerSubmit {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  line-height: 1;
}

.composer-attach {
  grid-area: attach;
  background: transparent;
  color: var(--ink-2);
  font-size: 22px;
}

.composer-attach:hover {
  background: var(--hover);
  color: var(--ink);
}

#composerSubmit {
  grid-area: send;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

#composerSubmit:disabled {
  opacity: 0.25;
}

.composer-attachments {
  grid-area: atts;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 4px 8px;
}

.attachment-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.attachment-chip.error {
  border-color: rgba(176, 58, 46, 0.45);
}

.attachment-thumb {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  color: var(--ink-2);
}

.attachment-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.attachment-size {
  color: var(--ink-2);
  font-size: 11px;
}

.attachment-state {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
}

.attachment-state.uploading {
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: attachment-spin 0.7s linear infinite;
}

.attachment-state.error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

@keyframes attachment-spin {
  to {
    transform: rotate(360deg);
  }
}

.attachment-remove {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hover);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
}

.topic-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 44px;
  z-index: 10;
  display: grid;
  min-width: 200px;
  max-width: min(360px, calc(100% - 56px));
  max-height: 260px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.topic-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 14px;
}

.topic-option.active,
.topic-option:hover {
  background: var(--hover);
}

.topic-option-new {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
}

/* ---------- 语音播放条 ---------- */

.speech-player {
  display: grid;
  grid-template-columns: 42px 36px 42px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  width: min(var(--content-width), calc(100% - 48px));
  margin: 0 auto 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
}

.speech-player-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  font-size: 18px;
  line-height: 1;
}

.speech-player-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.speech-player-step {
  width: 42px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.speech-player-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.speech-player-main {
  min-width: 0;
}

.speech-player-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-size: 12px;
}

.speech-player-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 项目首页 / 设置(画在聊天区里) ---------- */

.project-overview,
.settings-page {
  display: grid;
  gap: 16px;
}

.project-overview-hero h2 {
  margin: 2px 0 4px;
  font-size: 22px;
  font-weight: 600;
}

.project-overview-hero p {
  margin: 0;
  color: var(--ink-2);
}

.project-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.overview-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
  text-align: left;
}

.overview-card:hover {
  border-color: var(--ink-3);
}

.overview-card strong {
  font-size: 15px;
  font-weight: 600;
}

.overview-card span {
  color: var(--ink-2);
  font-size: 12.5px;
}

.settings-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.settings-hero p {
  margin: 0;
}

.avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  overflow: hidden;
}

.avatar-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  color: var(--ink-2);
  font-size: 22px;
  font-weight: 600;
}

.settings-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
}

.settings-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.settings-card p {
  margin: 0;
}

.settings-field {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.settings-field > span {
  color: var(--ink-2);
}

.settings-field input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.settings-field input[type="file"] {
  padding: 5px 0;
  border: 0;
  background: transparent;
}

.model-admin-list {
  display: grid;
}

.model-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.model-admin-row:first-child {
  border-top: 0;
}

.model-admin-row > div {
  display: grid;
}

.new-chat-inline {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--elevated);
  font-size: 13px;
}

.new-chat-inline:hover {
  border-color: var(--ink-3);
}

.settings-footer {
  display: flex;
  justify-content: center;
  padding: 8px 0 24px;
}

.logout-button {
  padding: 7px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--danger);
  font-size: 13.5px;
}

.logout-button:hover {
  border-color: var(--danger);
}

.source-row:hover strong {
  text-decoration: underline;
}

/* 模型来源的编辑框 */
.source-form {
  display: grid;
  gap: 10px;
}

.source-form select {
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.source-form .settings-field {
  grid-template-columns: 52px minmax(0, 1fr);
}

.source-error {
  margin: 0;
  color: var(--danger);
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-actions .spacer {
  flex: 1;
}

.primary-button {
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
}

.primary-button:disabled {
  opacity: 0.5;
}

.source-models-heading {
  margin: 18px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.source-models-heading h3 {
  margin: 0;
  font-size: 14px;
}

.source-models {
  display: grid;
  max-height: 46vh;
  overflow-y: auto;
}

.source-model {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 2px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-size: 13.5px;
}

.source-model:first-child {
  border-top: 0;
}

.source-model > span {
  display: grid;
  min-width: 0;
}

.source-model strong {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.source-model.failed strong {
  color: var(--ink-2);
}

/* ---------- 右栏:项目面板 ---------- */

.context-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}

.context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 8px 12px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.context-header > div {
  min-width: 0;
}

.context-header h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-tab {
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
}

.panel-tab:hover {
  background: var(--hover);
  color: var(--ink);
}

.panel-tab.active {
  background: var(--ink);
  color: #fff;
}

.panel-content {
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 24px;
}

.panel-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
}

.panel-block + .panel-block {
  margin-top: 12px;
}

.panel-block h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel-block > p {
  margin: 0;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-inline-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.panel-text {
  font-size: 13.5px;
  white-space: normal;
}

.fact-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.fact-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.fact-list dt {
  color: var(--ink-2);
}

.fact-list dd {
  margin: 0;
  text-align: right;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.switch-row > span {
  display: grid;
  gap: 2px;
  font-size: 13.5px;
}

.switch-row strong {
  font-weight: 600;
}

.item-list {
  display: grid;
  gap: 0;
}

.item {
  display: grid;
  gap: 2px;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}

.item:first-child {
  border-top: 0;
}

.item strong {
  font-weight: 600;
}

.item.coral strong {
  color: var(--danger);
}

button.item {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background: transparent;
  text-align: left;
}

button.item:first-child {
  border-top: 0;
}

button.item:hover {
  background: var(--hover);
}

.item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-actions {
  display: flex;
  flex: none;
  gap: 0;
}

.knowledge-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-main .small-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-main:hover strong {
  text-decoration: underline;
}

.topic-row .item-title-row {
  justify-content: flex-start;
}

.topic-state {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 12.5px;
}

.todo-list-name {
  padding: 10px 2px 2px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.todo-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px 6px calc(2px + var(--depth, 0) * 22px);
  font-size: 13.5px;
}

.todo-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.todo-row.done .todo-title {
  color: var(--ink-3);
  text-decoration: line-through;
}

.todo-row .todo-due {
  flex: none;
  margin: 0;
}

.member-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.member-invite input,
.search-form input,
.search-form select {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13.5px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}

.search-form button {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
}

.search-type {
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
}

.file-picker-command {
  position: relative;
  cursor: pointer;
}

.file-picker-command input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 预览弹窗(文档、资料) ---------- */

.detail-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(61, 57, 41, 0.3);
}

.detail-dialog-inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100dvh - 50px);
}

.detail-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 20px;
  border-bottom: 1px solid var(--line);
}

.detail-dialog-header h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
}

.detail-dialog-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-dialog-body {
  padding: 18px 20px 24px;
  overflow-y: auto;
}

.detail-image {
  display: block;
  max-height: 60vh;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 1099px) {
  .app-shell,
  body.context-collapsed .app-shell {
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
  }

  body.context-collapsed .context-column {
    visibility: visible;
  }

  /* 项目面板:从右边滑出来的抽屉。 */
  .context-column {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: min(var(--context-width), 92vw);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateX(105%);
    transition: transform 0.2s ease;
  }

  body.context-open .context-column {
    transform: none;
  }

  body.context-open .sidebar-scrim,
  body.sidebar-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    border: 0;
    background: rgba(61, 57, 41, 0.28);
  }

  .project-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 759px) {
  .app-shell,
  body.no-context .app-shell,
  body.context-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(300px, 86vw);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .project-rail {
    transform: none;
  }

  .sidebar-open-button,
  .sidebar-close-button {
    display: inline-grid;
  }

  .chat-header {
    padding: 6px 8px;
  }

  .model-picker select {
    max-width: 130px;
  }

  .message-list {
    padding: 16px 16px 24px;
  }

  .sticky-question {
    padding: 7px 16px;
  }

  .message.user .message-body {
    max-width: 88%;
  }

  .composer,
  .speech-player {
    width: calc(100% - 16px);
    margin-bottom: 8px;
  }

  body.composer-focused .message-list {
    padding-bottom: var(--composer-list-padding);
  }

  body.composer-focused .composer {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 0;
    z-index: 50;
    width: auto;
    transform: translateY(var(--composer-translate-y));
  }

  .settings-field {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .settings-field > span {
    grid-column: 1 / -1;
  }
}

/* ---------- 待办应用(左栏「应用 → 待办」) ---------- */

.app-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.app-entry svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-entry:hover {
  background: var(--hover);
}

.app-entry.active {
  background: var(--active);
  font-weight: 600;
}

.quick-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: min(var(--content-width), calc(100% - 48px));
  margin: 0 auto 8px;
}

.quick-action {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--elevated);
  font-size: 13px;
}

.quick-action:hover {
  border-color: var(--ink-3);
}

.todo-page {
  display: grid;
  gap: 10px;
}

.todo-back {
  justify-self: start;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
}

.todo-back:hover {
  background: var(--hover);
  color: var(--ink);
}

.todo-heading {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.todo-subheading {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.todo-smart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.todo-smart {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
  font-size: 14px;
}

.todo-smart strong {
  font-size: 18px;
  font-weight: 600;
}

.todo-smart:hover,
.todo-list-row:hover {
  border-color: var(--ink-3);
}

.todo-list-rows {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
  overflow: hidden;
}

.todo-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.todo-list-row:first-child {
  border-top: 0;
}

.todo-rows {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
  overflow: hidden;
}

.todo-rows .todo-row {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 12px 8px calc(12px + var(--depth, 0) * 22px);
  border-top: 1px solid var(--line);
}

.todo-rows .todo-row:first-child {
  border-top: 0;
}

.todo-rows .todo-check {
  margin-top: 3px;
}

.todo-open {
  display: grid;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.todo-open .todo-title {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.todo-open:hover .todo-title {
  text-decoration: underline;
}

.todo-row.done .todo-open .todo-title {
  color: var(--ink-3);
  text-decoration: line-through;
}

.todo-meta {
  color: var(--ink-3);
  font-size: 12px;
}

.todo-meta.overdue {
  color: var(--danger);
}

.todo-empty {
  margin: 0;
  padding: 12px;
}

.todo-add input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--elevated);
  font-size: 14px;
}

.todo-add input:focus {
  outline: none;
  border-color: var(--ink-3);
}

.todo-detail {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
}

.todo-detail label {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.todo-detail label > span {
  color: var(--ink-2);
}

.todo-detail input:not([type="checkbox"]),
.todo-detail textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
  resize: vertical;
}

.todo-detail .todo-detail-done {
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-detail-actions .spacer {
  flex: 1;
}

/* 沙箱「运行了代码」折叠块 */
.code-runs {
  margin: 4px 0 0.75em;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elevated);
}

.code-runs > summary {
  padding: 8px 12px;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}

.code-runs > summary::before {
  content: "›";
  display: inline-block;
  width: 14px;
  transition: transform 0.15s ease;
}

.code-runs[open] > summary::before {
  transform: rotate(90deg);
}

.code-run {
  padding: 0 12px 10px;
  border-top: 1px solid var(--line);
}

.code-run-head,
.code-run-label {
  padding: 8px 0 4px;
  color: var(--ink-3);
  font-size: 12px;
}

.message-body .code-run pre {
  margin: 0;
  max-height: 320px;
  overflow: auto;
}

.message-body .code-run-output {
  background: var(--surface);
}

/* 「文件」页 */
.artifacts-entry {
  margin-top: -8px;
}

.artifacts-page {
  display: grid;
  gap: 14px;
}

.artifact-search {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--elevated);
  font-size: 14px;
}

.artifact-search:focus {
  outline: none;
  border-color: var(--ink-3);
}

.artifact-list {
  display: grid;
  gap: 10px;
}

.artifact-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--elevated);
}

.artifact-card:hover {
  border-color: var(--ink-3);
}

.artifact-open {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.artifact-thumb {
  flex: none;
  width: 96px;
  height: 64px;
  border-radius: 10px;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
}

.artifact-thumb-icon {
  display: grid;
  place-items: center;
  color: var(--ink-2);
}

.artifact-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.artifact-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.artifact-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 110px;
}

.artifact-source {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 759px) {
  .artifact-thumb {
    width: 64px;
    height: 48px;
  }

  .artifact-actions {
    padding-left: 0;
  }
}
