:root {
  --canvas: #fbfaf7;
  --surface: #ffffff;
  --surface-muted: #f5f3ef;
  --surface-soft: #f8f6f2;
  --ink: #26242d;
  --ink-soft: #6c6875;
  --ink-faint: #9c98a4;
  --line: #e9e5df;
  --line-strong: #ded9d2;
  --indigo: #4f46a5;
  --indigo-deep: #39317f;
  --indigo-soft: #eeecff;
  --indigo-pale: #f7f5ff;
  --sage: #e6f3ed;
  --sage-ink: #266147;
  --amber: #fff4dc;
  --amber-ink: #885d10;
  --rose: #fdf0f1;
  --rose-ink: #9d3e4a;
  --shadow: 0 14px 36px rgba(45, 39, 71, .07);
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-w: 255px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:not(:disabled), select:not(:disabled), input:not(:disabled), textarea:not(:disabled) { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), select:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(79, 70, 165, .28); outline-offset: 2px; }
input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; background: #fff; color: var(--ink); transition: border-color .18s ease, box-shadow .18s ease; }
textarea { resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #c9c3d4; }
input:focus, textarea:focus, select:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 165, .09); outline: none; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
svg { display: block; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.skip-link { position: fixed; z-index: 40; left: 16px; top: -50px; padding: 8px 12px; border-radius: 8px; background: var(--indigo); color: white; transition: top .2s; }
.skip-link:focus { top: 16px; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 22px 14px 14px; border-right: 1px solid var(--line); background: #f8f7f4; transition: width .24s ease, padding .24s ease; overflow: hidden; }
.brand-row { display: flex; align-items: center; justify-content: space-between; min-height: 54px; gap: 8px; padding: 0 5px 0 8px; margin-bottom: 20px; }
.wordmark { width: 160px; max-width: calc(100% - 40px); height: auto; object-fit: contain; object-position: left center; }
.icon-button { display: grid; flex: 0 0 auto; width: 32px; height: 32px; padding: 0; place-items: center; border: 1px solid transparent; border-radius: 9px; color: var(--ink-soft); background: transparent; font-size: 20px; line-height: 1; transition: background .18s ease, color .18s ease, border-color .18s ease; }
.icon-button:hover { border-color: var(--line); background: #fff; color: var(--ink); }
.sidebar-collapse { font-size: 25px; }
.new-project-button { display: flex; align-items: center; gap: 9px; min-height: 39px; padding: 0 11px; border: 1px solid #d9d5eb; border-radius: 10px; background: var(--indigo-pale); color: var(--indigo-deep); font-weight: 650; transition: background .18s ease, transform .18s ease, border-color .18s ease; }
.new-project-button:hover { border-color: #bcb5e7; background: #edebff; transform: translateY(-1px); }
.button-plus { font-size: 20px; font-weight: 400; line-height: 1; }
.project-search { display: flex; align-items: center; gap: 8px; height: 36px; margin-top: 18px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; background: #f0eeea; color: var(--ink-faint); transition: border-color .18s ease, background .18s ease; }
.project-search:focus-within { border-color: #d1cde0; background: #fff; }
.project-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.project-search input { min-width: 0; height: 100%; padding: 0; border: none; border-radius: 0; background: transparent; box-shadow: none; font-size: 13px; }
.project-search input:focus { box-shadow: none; }
.project-nav { min-height: 0; padding: 23px 2px 0; overflow-y: auto; }
.nav-section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 8px; color: var(--ink-soft); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.project-count { min-width: 19px; padding: 1px 6px; border-radius: 12px; color: var(--ink-faint); background: #eeece7; font-size: 11px; letter-spacing: 0; text-align: center; }
.project-list { display: flex; flex-direction: column; gap: 2px; }
.project-list-empty { padding: 10px 7px; color: var(--ink-faint); font-size: 12px; }
.project-row { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 43px; padding: 7px; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; }
.project-row:hover { background: #f0eeea; }
.project-row.active { border-color: #e3e0f1; background: #efedfa; color: #3f3882; }
.project-row-mark { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #cbc7d6; }
.project-row.active .project-row-mark { background: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 165, .12); }
.project-row-text { min-width: 0; }
.project-row-name { overflow: hidden; font-size: 13px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.project-row-meta { overflow: hidden; margin-top: 1px; color: var(--ink-faint); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { margin-top: auto; padding-top: 14px; }
.plain-nav-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 7px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: 13px; text-align: left; }
.plain-nav-button:hover { background: #f0eeea; color: var(--ink); }
.plain-nav-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.local-note { padding: 7px 7px 0; margin: 0; color: var(--ink-faint); font-size: 11px; line-height: 1.45; }
.sidebar-collapsed { --sidebar-w: 63px; }
.sidebar-collapsed .sidebar { padding-right: 10px; padding-left: 10px; }
.sidebar-collapsed .wordmark, .sidebar-collapsed .new-project-button > span:not(.button-plus), .sidebar-collapsed .project-search input, .sidebar-collapsed .nav-section-heading span:first-child, .sidebar-collapsed .project-row-text, .sidebar-collapsed .plain-nav-button span, .sidebar-collapsed .local-note { display: none; }
.sidebar-collapsed .brand-row { justify-content: center; padding: 0; }
.sidebar-collapsed .sidebar-collapse { transform: rotate(180deg); }
.sidebar-collapsed .new-project-button { justify-content: center; padding: 0; }
.sidebar-collapsed .project-search { justify-content: center; padding: 0; }
.sidebar-collapsed .project-row { justify-content: center; }
.sidebar-collapsed .nav-section-heading { justify-content: center; }
.sidebar-collapsed .project-count { display: none; }
.sidebar-collapsed .plain-nav-button { justify-content: center; }

.workspace { display: flex; min-width: 0; flex-direction: column; min-height: 100vh; }
.workspace-header { display: flex; align-items: flex-start; justify-content: space-between; min-height: 88px; padding: 22px 28px 13px 34px; border-bottom: 1px solid rgba(233, 229, 223, .65); }
.project-heading { min-width: 0; }
.eyebrow { display: block; margin-bottom: 3px; color: var(--indigo); font-size: 10px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { overflow: hidden; margin-bottom: 1px; font-size: 18px; font-weight: 680; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
h2 { margin-bottom: 0; font-size: 15px; font-weight: 690; letter-spacing: -.015em; }
h3 { margin-bottom: 8px; font-size: 13px; font-weight: 700; }
#projectDescription { max-width: 690px; margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.network-state { max-width: 250px; color: var(--ink-faint); font-size: 11px; text-align: right; }
.network-state.is-error { color: var(--rose-ink); }
.network-state.is-ok { color: var(--sage-ink); }
.mobile-tabs { display: none; }
.workspace-columns { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(390px, 1fr) minmax(280px, .52fr) minmax(290px, .58fr); align-items: stretch; }
.conversation-pane, .context-pane, .result-pane { min-width: 0; min-height: 0; }
.conversation-pane { display: flex; flex-direction: column; padding: 16px clamp(22px, 3vw, 43px) 19px; }
.context-pane, .result-pane { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: rgba(255, 255, 255, .46); }
.result-pane { background: #fbfaff; }
.conversation-topline, .pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.conversation-actions { display: flex; gap: 3px; }
.conversation-select { width: min(170px, 23vw); padding: 5px 24px 5px 7px; color: var(--ink-soft); font-size: 11px; }
.pane-actions { display: flex; align-items: center; gap: 2px; }
.subtle-button, .text-button, .primary-button, .menu-action { border: 0; border-radius: 8px; transition: background .18s ease, color .18s ease, transform .18s ease; }
.subtle-button { padding: 6px 9px; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.subtle-button:hover { background: var(--surface-muted); color: var(--ink); }
.text-button { padding: 4px 0; background: transparent; color: var(--indigo); font-size: 13px; font-weight: 690; }
.text-button:hover { color: var(--indigo-deep); text-decoration: underline; }
.primary-button { padding: 9px 14px; background: var(--indigo); color: #fff; font-size: 13px; font-weight: 700; }
.primary-button:hover { background: var(--indigo-deep); transform: translateY(-1px); }
.primary-button:disabled { transform: none; }
.message-list { display: flex; flex: 1 1 200px; min-height: 110px; flex-direction: column; gap: 15px; padding: 28px 0 20px; overflow-y: auto; scroll-behavior: smooth; }
.conversation-empty { display: flex; flex: 1; align-items: center; justify-content: center; flex-direction: column; max-width: 420px; margin: auto; padding: 20px; text-align: center; }
.conversation-empty h2 { margin-bottom: 9px; font-size: clamp(20px, 2.2vw, 27px); font-weight: 620; letter-spacing: -.035em; }
.conversation-empty p { max-width: 390px; margin-bottom: 14px; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
/* 项目内空会话：显示"下一步"引导，隐藏"开始一个项目"（2026-11-07 修复） */
.conversation-empty .empty-next-steps { display: none; width: 100%; }
.conversation-empty .empty-next-steps p { margin-bottom: 10px; }
.empty-step-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.conversation-empty.is-in-project .empty-start-project { display: none; }
.conversation-empty.is-in-project .empty-next-steps { display: block; }
/* 移动端项目切换/设置入口：桌面端不显示 */
.mobile-quick-actions { display: none; }
.empty-symbol { display: grid; width: 40px; height: 40px; margin-bottom: 14px; place-items: center; border-radius: 14px; background: var(--indigo-soft); color: var(--indigo); font-size: 22px; transform: rotate(11deg); }
.message { display: flex; max-width: 90%; flex-direction: column; gap: 5px; }
.message.user { align-self: flex-end; align-items: flex-end; }
.message.assistant, .message.system { align-self: flex-start; }
.message-meta { color: var(--ink-faint); font-size: 10px; }
.message-bubble { max-width: 700px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 3px 13px 13px 13px; background: #fff; color: var(--ink); font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-bubble { border-color: #ded9f6; border-radius: 13px 3px 13px 13px; background: var(--indigo-pale); color: #332d74; }
.message.pending .message-bubble { border-style: dashed; opacity: .8; }
.message.failed .message-bubble { border-color: #edcbd0; background: var(--rose); }
.task-region { display: flex; flex-direction: column; gap: 8px; margin-bottom: 9px; }
.task-card { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid #dfdbea; border-radius: 10px; background: #faf9ff; color: var(--ink-soft); font-size: 12px; }
.task-card.running::before, .task-card.queued::before, .task-card.cancel-requested::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--indigo); content: ""; animation: breathe 1.3s ease-in-out infinite; }
.task-card.failed { border-color: #efd4d7; background: #fff9f9; color: var(--rose-ink); }
.task-card .task-copy { min-width: 0; flex: 1; }
.task-card .task-stage { color: inherit; }
.task-card .task-error { display: block; margin-top: 2px; font-size: 11px; }
.task-card .cancel-task { padding: 2px 4px; border: 0; background: transparent; color: var(--indigo); font-size: 11px; font-weight: 700; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }
.composer { flex: 0 0 auto; }
.composer-inner { padding: 8px 9px 7px 12px; border: 1px solid #d9d6e2; border-radius: 15px; background: #fff; box-shadow: 0 4px 18px rgba(48, 43, 78, .05); transition: box-shadow .18s ease, border-color .18s ease; }
.composer-inner:focus-within { border-color: #a79fd7; box-shadow: 0 5px 21px rgba(66, 56, 125, .11); }
#chatInput { display: block; min-height: 32px; max-height: 150px; padding: 4px 1px; border: 0; background: transparent; box-shadow: none; font-size: 14px; line-height: 1.55; resize: none; }
#chatInput:focus { box-shadow: none; }
.composer-controls { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding-top: 4px; }
.channel-toggle { display: flex; gap: 1px; padding: 2px; border-radius: 8px; background: #f1eff3; }
.channel-option { padding: 4px 7px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); font-size: 11px; }
.channel-option.active { background: #fff; color: var(--indigo-deep); box-shadow: 0 1px 3px rgba(43, 37, 76, .1); font-weight: 650; }
.send-button { display: grid; width: 29px; height: 29px; padding: 0; place-items: center; border: 0; border-radius: 8px; background: var(--indigo); color: #fff; transition: background .18s ease, transform .18s ease; }
.send-button:hover:not(:disabled) { background: var(--indigo-deep); transform: translate(1px, -1px); }
.send-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.75; }
.composer-note { padding: 5px 4px 0; margin: 0; color: var(--ink-faint); font-size: 10px; }
.pane-heading { flex: 0 0 auto; padding: 20px 20px 13px; border-bottom: 1px solid var(--line); }
.context-content, .result-content { min-height: 0; padding: 13px; overflow-y: auto; }
.panel-empty { display: flex; align-items: flex-start; gap: 9px; padding: 13px 8px; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.panel-empty::before { width: 5px; height: 5px; flex: 0 0 auto; margin-top: 7px; border-radius: 50%; background: #c3bdd6; content: ""; }
.context-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 11px; }
.context-toolbar .primary-button { flex: 1; min-width: 130px; }
.context-toolbar select { width: auto; min-width: 0; padding: 5px 7px; color: var(--ink-soft); font-size: 11px; }
.context-status { display: flex; align-items: center; gap: 5px; width: 100%; color: var(--ink-soft); font-size: 11px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #b8b4bd; }
.status-dot.dirty { background: var(--amber-ink); }
.status-dot.saved { background: var(--sage-ink); }
.context-confirmation { padding: 10px; margin: 0 0 12px; border: 1px solid #e5e0f8; border-radius: 10px; background: #faf9ff; }
.context-confirmation label { display: flex; align-items: flex-start; gap: 7px; color: #514b70; font-size: 11px; line-height: 1.45; }
.context-confirmation input { width: auto; margin: 2px 0 0; padding: 0; accent-color: var(--indigo); }
.context-confirmation p { margin: 6px 0 0 20px; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.context-section { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .75); overflow: hidden; }
.context-section summary { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 670; list-style: none; }
.context-section summary::-webkit-details-marker { display: none; }
.context-section summary::after { color: var(--ink-faint); content: "+"; font-size: 17px; font-weight: 400; }
.context-section[open] summary { border-bottom: 1px solid var(--line); }
.context-section[open] summary::after { content: "−"; }
.context-section-count { padding: 1px 5px; border-radius: 8px; background: var(--surface-muted); color: var(--ink-faint); font-size: 10px; font-weight: 600; }
.context-section-body { padding: 10px; }
.edit-problem { min-height: 68px; border-color: #e4e0ec; font-size: 12px; line-height: 1.5; }
.context-item { position: relative; padding: 9px; margin-bottom: 8px; border: 1px solid #e8e4de; border-radius: 9px; background: #fff; }
.context-item:last-child { margin-bottom: 0; }
.context-item-grid { display: grid; grid-template-columns: 1fr 46px; gap: 6px; }
.context-item label { display: block; margin-bottom: 6px; color: var(--ink-soft); font-size: 10px; }
.context-item label:last-child { margin-bottom: 0; }
.context-item input, .context-item textarea, .context-item select { margin-top: 3px; padding: 6px 7px; font-size: 11px; }
.context-item textarea { min-height: 45px; }
.context-item .remove-item { position: absolute; top: 5px; right: 5px; width: 21px; height: 21px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #9b96a0; font-size: 15px; line-height: 1; }
.context-item .remove-item:hover { background: var(--rose); color: var(--rose-ink); }
.context-item.has-remove { padding-right: 27px; }
.inline-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.attribute-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.attribute-grid label { margin: 0; }
.source-line { display: flex; align-items: center; gap: 5px; margin-top: 6px; color: var(--ink-faint); font-size: 9px; }
.source-tag { padding: 1px 5px; border-radius: 6px; background: #f1eff4; color: #6e687c; }
.source-tag.inference { background: var(--amber); color: var(--amber-ink); }
.constraint-kind { display: inline-flex; width: auto; margin-bottom: 4px; }
.constraint-item.hard { border-left: 3px solid #b77526; }
.unknown-item { border-left: 3px solid #9b94a8; }
.add-inline { display: flex; align-items: center; gap: 5px; width: 100%; padding: 4px 1px 0; border: 0; background: transparent; color: var(--indigo); font-size: 11px; font-weight: 650; text-align: left; }
.add-inline:hover { color: var(--indigo-deep); text-decoration: underline; }
.add-inline span { font-size: 15px; font-weight: 400; }
.context-warning { padding: 8px 9px; margin-bottom: 9px; border-radius: 8px; background: var(--amber); color: var(--amber-ink); font-size: 11px; line-height: 1.5; }
.evidence-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.evidence-actions .text-button { font-size: 10px; }

.result-intro { padding: 11px; margin-bottom: 11px; border: 1px solid #ddd8f4; border-radius: 12px; background: linear-gradient(145deg, #f5f3ff, #fdfcff); }
.result-label { margin-bottom: 3px; color: var(--indigo); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.result-recommendation { margin-bottom: 4px; font-size: 16px; font-weight: 720; letter-spacing: -.025em; overflow-wrap: anywhere; }
.result-intro p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.result-section { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow: hidden; }
.result-section-heading { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px 7px; }
.result-section-heading h3 { margin: 0; font-size: 12px; }
.result-section-heading span { color: var(--ink-faint); font-size: 10px; }
.support-note { padding: 0 10px 7px; margin: 0; color: var(--ink-faint); font-size: 10px; line-height: 1.45; }
.score-list { padding: 0 10px 10px; }
.score-row { margin: 8px 0; }
.score-row-head { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 4px; font-size: 11px; }
.score-row-head strong { overflow: hidden; font-weight: 640; text-overflow: ellipsis; white-space: nowrap; }
.score-row-head span { flex: 0 0 auto; color: var(--ink-soft); }
.support-track { height: 5px; overflow: hidden; border-radius: 4px; background: #eceaf0; }
.support-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #8278c3, var(--indigo)); }
.score-row.eliminated .support-fill { background: #d4b1b6; }
.elimination-note { margin-top: 3px; color: var(--rose-ink); font-size: 10px; }
.bullet-list { padding: 0 12px 10px 25px; margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.bullet-list li { margin: 3px 0; overflow-wrap: anywhere; }
.risk-list li { color: var(--rose-ink); }
.evidence-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 10px 10px; }
.evidence-chip { max-width: 100%; padding: 4px 7px; border: 1px solid #e3e0f0; border-radius: 7px; background: #faf9ff; color: #5c5582; font-size: 10px; overflow-wrap: anywhere; }
.third-option { padding: 0 10px 10px; }
.third-option h4 { margin: 0 0 4px; font-size: 12px; }
.third-option p { margin: 0 0 6px; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.third-option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 8px 0; }
.third-option-grid div { padding: 5px; border-radius: 7px; background: var(--surface-soft); color: var(--ink-soft); font-size: 10px; }
.third-option-grid strong { display: block; margin-bottom: 1px; color: var(--ink); font-weight: 630; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
.result-actions .subtle-button, .result-actions .primary-button { min-height: 34px; border: 1px solid var(--line); text-align: center; }
.result-actions .primary-button { border-color: var(--indigo); }
.result-actions .full { grid-column: 1 / -1; }
.details-summary { padding: 9px 10px; cursor: pointer; color: var(--ink-soft); font-size: 11px; }
.details-summary + div { padding: 0 10px 10px; }
.version-list { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px; }
.version-row { width: 100%; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: 10px; text-align: left; }
.version-row:hover, .version-row.selected { border-color: #bbb4e0; background: var(--indigo-pale); }
.version-row strong { display: block; margin-bottom: 2px; font-size: 11px; }
.version-row p { margin: 0; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.version-row small { display: block; margin-top: 4px; color: var(--ink-faint); font-size: 9px; }
.version-preview { padding: 0 10px 10px; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.version-preview strong { color: var(--ink); font-size: 11px; }
.version-preview p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-box { padding: 0 10px 10px; }
.review-box textarea { min-height: 56px; margin-bottom: 5px; font-size: 11px; }
.analysis-summary { padding: 0 10px 10px; color: var(--ink-soft); font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

.app-dialog { width: min(545px, calc(100vw - 28px)); max-height: min(720px, calc(100dvh - 28px)); padding: 0; border: 0; border-radius: var(--radius-lg); background: #fff; color: var(--ink); box-shadow: 0 24px 80px rgba(34, 29, 58, .23); }
.app-dialog::backdrop { background: rgba(41, 37, 50, .28); backdrop-filter: blur(2px); }
.dialog-card { display: flex; flex-direction: column; gap: 15px; padding: 22px; overflow-y: auto; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { font-size: 19px; }
.dialog-card > label { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 620; }
.dialog-card > label input, .dialog-card > label textarea, .dialog-card > label select { margin-top: 5px; color: var(--ink); font-size: 13px; font-weight: 400; }
.dialog-note { margin: -5px 0 0; color: var(--ink-faint); font-size: 11px; line-height: 1.55; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-top: 1px; }
.compact-dialog { width: min(430px, calc(100vw - 28px)); }
.menu-actions { display: flex; flex-direction: column; gap: 3px; }
.menu-action { width: 100%; padding: 10px; background: transparent; color: var(--ink); font-size: 13px; text-align: left; }
.menu-action:hover { background: var(--surface-muted); }
.menu-action.danger { color: var(--rose-ink); }
.menu-action.danger:hover { background: var(--rose); }
.confirm-description { margin: -4px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.settings-card { gap: 18px; }
.settings-section { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-section h3 { margin-bottom: 6px; }
.settings-note { margin: 0 0 10px; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.profile-use-control { display: flex; align-items: flex-start; gap: 7px; margin: 2px 0 6px; color: var(--ink); font-size: 12px; line-height: 1.45; }
.profile-use-control input, .profile-confirm-control input { width: auto; margin: 2px 0 0; padding: 0; accent-color: var(--indigo); }
.language-options { display: flex; flex-wrap: wrap; gap: 5px; }
.language-options button { padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink-soft); font-size: 11px; }
.language-options button.active, .language-options button:hover { border-color: #aaa2d7; background: var(--indigo-pale); color: var(--indigo-deep); }
.profile-row { display: flex; align-items: flex-start; gap: 7px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.profile-row:last-child { border-bottom: 0; }
.profile-row p { flex: 1; margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.profile-row small { display: block; margin-top: 2px; color: var(--ink-faint); font-size: 10px; }
.profile-row button { padding: 1px 3px; border: 0; background: transparent; color: var(--rose-ink); font-size: 12px; }
.profile-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
.profile-actions .text-button { color: var(--indigo); font-size: 10px; }
.profile-editor { width: 100%; }
.profile-edit-statement { padding: 6px 8px; font-size: 11px; }
.profile-confirm-control { display: flex; align-items: flex-start; gap: 5px; margin-top: 5px; color: var(--ink-soft); font-size: 10px; }
.inline-create { display: flex; gap: 6px; margin-top: 9px; }
.inline-create input { min-width: 0; padding: 6px 8px; font-size: 11px; }
.inline-create .subtle-button { flex: 0 0 auto; border: 1px solid var(--line); }
.settings-empty { padding: 5px 0; color: var(--ink-faint); font-size: 11px; }
.model-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.model-status-row:last-child { border-bottom: 0; }
.model-status-row strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.model-status-row span { flex: 0 0 auto; padding: 2px 6px; border-radius: 7px; background: var(--surface-muted); color: var(--ink-soft); font-size: 10px; }
.model-status-row.is-verified span { background: var(--sage); color: var(--sage-ink); }
.model-status-row.is-auth-failed span { background: var(--rose); color: var(--rose-ink); }
.automation-row { padding: 7px 0; border-bottom: 1px solid var(--line); }
.automation-row:last-child { border-bottom: 0; }
.automation-row strong { display: block; font-size: 12px; }
.automation-row span { color: var(--ink-faint); font-size: 10px; }
.automation-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.automation-actions .subtle-button { border: 1px solid var(--line); }
.danger-outline { color: var(--rose-ink); }
.danger-outline:hover { background: var(--rose); }
.toast-region { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: flex; width: min(365px, calc(100vw - 36px)); flex-direction: column; gap: 7px; pointer-events: none; }
.toast { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); color: var(--ink-soft); font-size: 12px; animation: toast-in .22s ease-out; }
.toast.success { border-color: #cfe7da; color: var(--sage-ink); }
.toast.error { border-color: #efd2d5; color: var(--rose-ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

@media (min-width: 1261px) {
  .workspace-columns:has(.context-pane.is-collapsed) { grid-template-columns: minmax(390px, 1fr) 46px minmax(290px, .58fr); }
  .workspace-columns:has(.result-pane.is-collapsed) { grid-template-columns: minmax(390px, 1fr) minmax(280px, .52fr) 46px; }
  .workspace-columns:has(.context-pane.is-collapsed):has(.result-pane.is-collapsed) { grid-template-columns: minmax(390px, 1fr) 46px 46px; }
  .context-pane.is-collapsed, .result-pane.is-collapsed { overflow: hidden; }
  .context-pane.is-collapsed .pane-heading, .result-pane.is-collapsed .pane-heading { justify-content: center; padding: 12px 6px; }
  .context-pane.is-collapsed .pane-heading > div:first-child, .result-pane.is-collapsed .pane-heading > div:first-child, .context-pane.is-collapsed #createDecisionButton, .result-pane.is-collapsed [data-action="close-result"] { display: none; }
  .context-pane.is-collapsed .context-content, .result-pane.is-collapsed .result-content { display: none; }
}

@media (max-width: 1260px) {
  .workspace-columns { grid-template-columns: minmax(370px, 1fr) minmax(270px, .58fr); }
  .workspace-columns:has(.context-pane.is-collapsed) { grid-template-columns: minmax(370px, 1fr) 46px; }
  .result-pane { position: fixed; z-index: 20; top: 0; right: 0; width: min(420px, calc(100vw - 40px)); height: 100dvh; box-shadow: -12px 0 35px rgba(39, 33, 65, .1); transform: translateX(105%); transition: transform .24s ease; }
  .result-pane.drawer-open { transform: translateX(0); }
  .result-pane .pane-heading { padding-top: 22px; }
}
@media (max-width: 880px) {
  :root { --sidebar-w: 62px; }
  .sidebar { padding: 15px 9px 10px; }
  .wordmark, .new-project-button > span:not(.button-plus), .project-search input, .nav-section-heading span:first-child, .project-row-text, .plain-nav-button span, .local-note, .sidebar-collapse { display: none; }
  .brand-row { justify-content: center; padding: 0; margin-bottom: 20px; }
  .new-project-button { justify-content: center; padding: 0; }
  .project-search { justify-content: center; padding: 0; }
  .project-row { justify-content: center; }
  .nav-section-heading { justify-content: center; }
  .project-count { display: none; }
  .plain-nav-button { justify-content: center; }
  .workspace-header { padding-left: 24px; }
  .workspace-columns { grid-template-columns: minmax(360px, 1fr) minmax(250px, .65fr); }
  .conversation-pane { padding-right: 23px; padding-left: 24px; }
}
@media (max-width: 700px), (max-width: 1000px) and (orientation: portrait) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; top: 0; left: 0; width: 100%; height: auto; min-height: 55px; padding: 9px 14px; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(251,250,247,.95); backdrop-filter: blur(12px); overflow: visible; }
  .brand-row { display: flex; min-height: 34px; height: 34px; padding: 0; margin: 0; }
  .wordmark { display: block; width: 120px; max-width: 100%; }
  .sidebar .new-project-button { width: 32px; min-height: 32px; margin-left: auto; border: 0; background: var(--indigo-soft); }
  .sidebar .new-project-button > span:not(.button-plus) { display: none; }
  .sidebar .project-search, .sidebar .project-nav, .sidebar .sidebar-foot { display: none; }
  /* 2026-11-07 修复：常驻"项目/设置"入口；点"项目"把搜索与项目列表展开成下拉面板，
     复用桌面端同一份 projectList 渲染，不新建第二套列表。 */
  .mobile-quick-actions { display: flex; gap: 5px; margin-left: 7px; }
  .mobile-quick-button { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-soft); font-size: 11px; font-weight: 620; }
  .mobile-quick-button[aria-expanded="true"] { border-color: #c9c3ec; background: var(--indigo-pale); color: var(--indigo-deep); }
  .mobile-quick-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
  .app-shell.mobile-nav-open .sidebar { flex-wrap: wrap; align-items: center; padding-bottom: 12px; }
  .app-shell.mobile-nav-open .project-search { display: flex; flex: 0 0 100%; margin-top: 10px; }
  .app-shell.mobile-nav-open .project-nav { display: block; flex: 0 0 100%; max-height: 48dvh; padding-top: 8px; overflow-y: auto; }
  .workspace { min-height: 100dvh; padding-top: 55px; }
  .workspace-header { min-height: 63px; padding: 11px 14px 7px; }
  .workspace-header .eyebrow { display: none; }
  h1 { font-size: 16px; }
  #projectDescription { max-width: 240px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .network-state { max-width: 116px; font-size: 10px; }
  .mobile-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 5px 12px 6px; border-bottom: 1px solid var(--line); background: #fffdfa; }
  .mobile-tab { min-height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-soft); font-size: 11px; font-weight: 620; }
  .mobile-tab.active { background: var(--indigo-pale); color: var(--indigo-deep); }
  .workspace-columns { display: block; min-height: 0; }
  .conversation-pane, .context-pane, .result-pane { display: none; height: calc(100dvh - 154px); border: 0; }
  .conversation-pane.pane-active, .context-pane.pane-active, .result-pane.pane-active { display: flex; }
  .conversation-pane { padding: 12px 15px 13px; }
  .context-pane, .result-pane { position: static; width: auto; box-shadow: none; transform: none; transition: none; background: #fbfaf7; }
  .result-pane.drawer-open { transform: none; }
  .pane-heading { padding: 13px 15px 10px; }
  .context-content, .result-content { padding: 10px 14px; }
  .conversation-topline { min-height: 29px; }
  .conversation-actions .subtle-button { padding: 4px 5px; }
  .conversation-select { max-width: 120px; }
  .message-list { padding-top: 17px; }
  .conversation-empty { padding-bottom: 44px; }
  .conversation-empty h2 { font-size: 23px; }
  .message { max-width: 96%; }
  .composer-note { padding-bottom: env(safe-area-inset-bottom); }
  .app-dialog { max-height: calc(100dvh - 22px); }
  .dialog-card { padding: 18px; }
  /* 2026-11-07 修复：移动端 toast 移到顶部、只显示最新一条，避免堆叠遮挡底部输入区 */
  .toast-region { top: 62px; right: 10px; bottom: auto; left: 10px; width: auto; }
  .toast-region .toast:not(:last-child) { display: none; }
  .context-pane.is-collapsed, .result-pane.is-collapsed { overflow: visible; }
  .context-pane.is-collapsed .pane-heading, .result-pane.is-collapsed .pane-heading { justify-content: space-between; }
  .context-pane.is-collapsed .pane-heading > div:first-child, .result-pane.is-collapsed .pane-heading > div:first-child, .context-pane.is-collapsed #createDecisionButton, .result-pane.is-collapsed [data-action="close-result"] { display: grid; }
  .context-pane.is-collapsed .context-content, .result-pane.is-collapsed .result-content { display: block; }
}
/* 2.0.0：本机账号 / 关于 / 版权 / 免责（比赛与内测版） */
.account-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.account-label { min-width: 96px; font-size: 12px; color: var(--ink-soft); }
.account-value { flex: 1; font-size: 12px; letter-spacing: .04em; word-break: break-all; color: var(--ink, #2b2a26); }
.account-input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid rgba(0,0,0,.14); border-radius: 8px; font-size: 12px; background: #fff; }
/* 三种登录方式：页签 + 面板 */
.account-tabs { display: flex; gap: 4px; margin: 10px 0 6px; border-bottom: 1px solid rgba(0,0,0,.08); }
.account-tab { border: 0; background: transparent; padding: 7px 10px; font-size: 12px; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; }
.account-tab.is-active { color: var(--ink, #2b2a26); border-bottom-color: var(--accent, #6b5b3e); font-weight: 600; }
.account-pane { padding: 4px 0 8px; }
.account-pane[hidden] { display: none; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.account-summary { margin-top: 10px; padding-top: 8px; border-top: 1px dashed rgba(0,0,0,.1); }
.account-recover { margin-top: 8px; }
.account-recover summary { font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.about-section { border-top: 1px solid rgba(0,0,0,.08); padding-top: 14px; }
.about-brand { font-size: 16px; font-weight: 600; margin: 2px 0; }
.about-version { font-size: 11px; font-weight: 500; color: var(--ink-soft); margin-left: 6px; padding: 1px 6px; border: 1px solid rgba(0,0,0,.14); border-radius: 10px; vertical-align: middle; }
.about-studio { font-size: 12px; margin: 2px 0 8px; color: var(--ink-soft); }
.disclaimer-list { margin: 8px 0 0; padding-left: 18px; }
.disclaimer-list li { font-size: 11px; line-height: 1.65; color: var(--ink-soft); margin-bottom: 5px; }
@media (max-width: 700px), (max-width: 1000px) and (orientation: portrait) {
  .account-row { flex-wrap: wrap; gap: 6px; }
  .account-label { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Workspace content scrolls inside its panels, never stretches the viewport. */
html, body { height: 100%; min-height: 0; overflow: hidden; }
.app-shell { height: var(--app-height, 100dvh); min-height: 0; overflow: hidden; }
.sidebar { height: 100%; min-height: 0; }
.workspace { height: 100%; min-height: 0; overflow: hidden; }
.workspace-header, .conversation-topline, .mobile-tabs { flex: 0 0 auto; }
#projectDescription { max-height: 36px; overflow: auto; overflow-wrap: anywhere; }
.workspace-columns { flex: 1 1 0; overflow: hidden; }
.conversation-pane, .context-pane, .result-pane { overflow: hidden; }
.message-list { flex: 1 1 0; min-height: 0; overscroll-behavior: contain; scroll-behavior: auto; }
.message-list > .message { flex: 0 0 auto; }
.conversation-empty { flex: 1 1 0; min-height: 0; overflow-y: auto; justify-content: safe center; }
.conversation-empty > * { flex-shrink: 0; }
.context-content, .result-content { flex: 1 1 0; min-height: 0; overscroll-behavior: contain; overflow-wrap: anywhere; }
.context-toolbar { position: sticky; top: -13px; z-index: 2; padding-top: 8px; background: #fbfaf7; border-bottom: 1px solid var(--line); }
.message-bubble summary { cursor: pointer; white-space: pre-wrap; }
.message-bubble[open] summary { margin-bottom: 8px; }
.result-fold > summary, .historical-result > summary { cursor: pointer; list-style: none; }
.result-fold > summary::before, .historical-result > summary::before { content: "▸"; margin-right: 6px; color: var(--ink-faint); }
.result-fold[open] > summary::before, .historical-result[open] > summary::before { content: "▾"; }
.historical-result { padding: 10px; }
.historical-result > summary { margin-bottom: 8px; font-size: 12px; color: var(--amber-ink); }
.result-notice { padding: 9px 10px; margin-bottom: 10px; border-radius: 8px; background: var(--amber); color: var(--amber-ink); font-size: 11px; white-space: pre-wrap; }
.result-version { display: block; margin-bottom: 5px; color: var(--ink-faint); font-size: 11px; }
.task-region { flex: 0 1 auto; max-height: 25%; min-height: 0; overflow-y: auto; }
.task-region:empty { display: none; }
.pane-task-region { padding: 8px 13px 0; }
.task-region > .task-card { flex: 0 0 auto; }
.task-card .task-hint, .task-card .task-stage { display: block; overflow-wrap: anywhere; font-size: 11px; }
.task-buttons { display: flex; flex: 0 0 auto; flex-direction: column; gap: 4px; }
.task-card.waiting-stopped::before { animation: none; }
@media (min-width: 1261px) {
  .context-pane.is-collapsed .pane-task-region, .result-pane.is-collapsed .pane-task-region { display: none; }
}
@media (min-width: 701px) and (max-width: 1260px) {
  .result-pane { height: var(--app-height, 100dvh); }
  .context-pane.is-collapsed .pane-task-region { display: none; }
}
@media (max-width: 700px), (max-width: 1000px) and (orientation: portrait) {
  .sidebar { height: auto; min-height: 55px; }
  .workspace { min-height: 0; }
  .workspace-columns { min-width: 0; min-height: 0; }
  .conversation-pane, .context-pane, .result-pane { height: 100%; min-height: 0; max-height: 100%; width: 100%; }
  #chatInput { max-height: min(120px, 20dvh); overflow-y: auto; }
  .context-toolbar { top: -10px; }
  .context-pane.is-collapsed, .result-pane.is-collapsed { overflow: hidden; }
  .conversation-topline { flex-wrap: wrap; gap: 4px; }
  .conversation-actions { margin-left: auto; }
}

/* 2.0.1: display dated provider evidence, never promise current availability. */
.model-status-detail { min-width: 0; max-width: 75%; text-align: right; overflow-wrap: anywhere; }
.model-status-detail small { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 10px; }

/* Independent beta entry: a plain new-window link, never an app action. */
.beta-entry-link { display: block; padding: 8px 7px; border-radius: 8px; color: var(--indigo); font-size: 12px; text-decoration: none; overflow-wrap: anywhere; }
.beta-entry-link:hover { color: var(--indigo-deep); background: var(--indigo-pale); text-decoration: underline; }
.beta-entry-link:focus-visible { outline: 3px solid rgba(79, 70, 165, .28); outline-offset: 2px; }
.sidebar-collapsed .sidebar-foot .beta-entry-link { display: none; }
@media (min-width: 701px) and (max-width: 880px) { .sidebar-foot .beta-entry-link { display: none; } }

/* Personal API settings opens separately and is never a workspace action. */
.api-settings-entry-link { display: block; padding: 8px 7px; border-radius: 8px; color: var(--indigo); font-size: 12px; text-decoration: none; overflow-wrap: anywhere; }
.api-settings-entry-link:hover { background: var(--indigo-pale); color: var(--indigo-deep); text-decoration: underline; }
.api-settings-entry-link:focus-visible { outline: 3px solid rgba(79, 70, 165, .28); outline-offset: 2px; }
.sidebar-collapsed .sidebar-foot .api-settings-entry-link { display: none; }
