/* 对设计系统的本地扩展（T-105），待回灌工件：会话对话流的智能体气泡与子对话框。只引用令牌变量。 */
.ty-msg { max-width: min(680px, 100%); min-width: 0; }
/* 左右气泡各向内留出与子对话框缩进相同的 space-4，使边缘对齐（用户 2026-10-25 要求）。 */
.ty-flow > .ty-msg:not(.ty-msg-user) { margin-right: var(--space-4); }
.ty-flow > .ty-msg-user { margin-left: var(--space-4); }
.ty-msg-agent .ty-msg-bubble, .ty-msg-theyais .ty-msg-bubble { background: var(--info-soft); border-color: var(--info-soft); }
.ty-msg-theyais .ty-msg-meta strong { color: var(--info-ink); }
.ty-msg-meta { flex-wrap: wrap; align-items: center; }
.ty-msg-user .ty-msg-meta { justify-content: flex-end; }
.ty-msg-bubble > .ty-msg-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ty-msg-bubble > .ty-msg-source { margin: var(--space-2) 0 0; color: var(--ink-muted); white-space: normal; overflow-wrap: anywhere; }
.ty-subthread { display: flex; flex-direction: column; gap: var(--space-3); margin-left: var(--space-4); padding: var(--space-3) var(--space-4); border-left: 2px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-sunken); min-width: 0; }
.ty-subthread-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--ink-muted); }
.ty-subthread-more { display: flex; flex-direction: column; gap: var(--space-3); }
.ty-subthread-more > summary { cursor: pointer; color: var(--link); min-height: var(--touch-target, 0); display: flex; align-items: center; }
.ty-subthread-more > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ty-subthread-more[open] > summary { margin-bottom: var(--space-3); }
.ty-flow { display: flex; flex-direction: column; gap: var(--space-4); }
/* 大屏时共用抽屉占半屏（T-107）；其余沿用 ds.css 的 min(var(--drawer-width), 95vw)。 */
@media (min-width: 1280px) { .ty-drawer { width: 50vw; } }
/* 子对话框内的右侧气泡（对方智能体）：不套顶层流的外边距，保持 info-soft 底。 */
.ty-subthread .ty-msg-user { align-self: flex-end; }
.ty-subthread .ty-msg-assistant { align-self: flex-start; }
/* 子智能体折叠子对话框（T-112）：摘要行可点，展开后气泡左右排列。 */
details.ty-subagent > summary, details.ty-subagent-orphans > summary { cursor: pointer; color: var(--link); min-height: var(--touch-target, 0); display: flex; align-items: center; }
details.ty-subagent > summary:focus-visible, details.ty-subagent-orphans > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
details.ty-subagent[open] > summary, details.ty-subagent-orphans[open] > summary { margin-bottom: var(--space-3); }
.ty-subagent-orphans { margin-left: 0; }
.ty-popover { position: absolute; z-index: 5; transform: translateX(-50%); width: min(360px, 92%); max-height: 320px; overflow: auto; padding: var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-popover); }
.ty-popover-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.ty-popover-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: var(--space-2); background: transparent; border: 0; border-radius: var(--radius-lg); color: var(--ink); font: inherit; text-align: left; min-height: var(--touch-target, 0); }
button.ty-popover-item { cursor: pointer; }
button.ty-popover-item:hover { background: var(--surface-hover); }
.ty-popover-title { margin: 0 0 var(--space-2); color: var(--ink-muted); }
.ty-popover-item .caption { color: var(--ink-muted); }
/* 会话关系图（T-117，T-119 连线）：HTML 卡片与缩进分支画树，附加边是绝对定位的 SVG 正交折线（不接收指针，按来源着色），计数徽标是叠在上面的按钮；窄屏纵向堆叠。 */
.ty-tree { position: relative; padding: var(--space-4) 0 var(--space-6); }
.ty-tree-content { display: flex; flex-direction: column; align-items: center; }
.ty-tree-row { display: flex; justify-content: center; width: 100%; }
.ty-tree-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--space-3) var(--space-4); min-height: var(--touch-target); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ty-tree-card .caption, .ty-tree-leaf .caption { color: var(--ink-muted); }
.ty-tree-card:hover, .ty-tree-leaf:hover, .ty-tree-badge:hover { background: var(--surface-hover); }
.ty-tree-node { width: 240px; align-items: center; text-align: center; }
.ty-tree-stem { position: relative; width: 0; height: 56px; }
.ty-tree-stem::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--line-strong); }
.ty-tree-stem-badge { position: absolute; left: 0; top: 50%; transform: translate(-50%, -50%); }
.ty-tree-gap { height: var(--space-8); }
.ty-tree-lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 200px) minmax(160px, 200px); gap: var(--space-6); width: 100%; align-items: start; }
.ty-tree-orca { position: relative; min-width: 0; padding: calc(var(--space-10) + var(--space-8)) var(--space-8) var(--space-10); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.ty-tree-orca-title { position: absolute; bottom: var(--space-3); left: var(--space-4); margin: 0; color: var(--ink-muted); }
.ty-tree-pms { display: flex; flex-wrap: wrap; align-items: flex-start; gap: calc(var(--space-10) + var(--space-8)) var(--space-4); }
.ty-tree-pm { flex: 1 1 220px; max-width: 320px; min-width: 0; padding: var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ty-tree-pm-head { width: 100%; min-height: 0; padding: var(--space-2) var(--space-3); border: 0; }
.ty-tree-branch { list-style: none; margin: var(--space-1) 0 0 var(--space-4); padding: 0; }
.ty-tree-branch > li { position: relative; padding-left: var(--space-4); }
.ty-tree-branch > li::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--line-strong); }
.ty-tree-branch > li:last-child::before { bottom: auto; height: 22px; }
.ty-tree-branch > li::after { content: ''; position: absolute; left: 0; top: 22px; width: var(--space-3); border-top: 1px solid var(--line-strong); }
.ty-tree-leaf { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: var(--touch-target); padding: var(--space-2); background: transparent; border: 0; border-radius: var(--radius-md); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ty-tree-empty { padding: var(--space-2) 0 var(--space-2) var(--space-4); color: var(--ink-muted); }
.ty-tree-col { min-width: 0; margin-top: calc(var(--space-10) + var(--space-8) + 1px); padding: var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ty-tree-col-title { margin: 0 0 var(--space-2); color: var(--ink-muted); }
.ty-tree-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.ty-tree-badge { min-height: 22px; padding: 0 var(--space-2); background: var(--surface); border: 1px solid var(--line-control); border-radius: var(--radius-sm); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.ty-tree-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ty-tree-badges { position: absolute; inset: 0; pointer-events: none; }
.ty-tree-edge-badge { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; }
/* 按来源着色：你的指令与会话 brand-ink；汇智助手 投递的决定 info-ink；清单关系点线 line-control（line-strong 对 bg-page 不到 3:1）。徽标边框与文字同色。 */
.ty-tree-edge { fill: none; stroke-width: 1.5; transition: opacity 0.12s, stroke-width 0.12s; }
.ty-tree-edge-user { stroke: var(--brand-ink); }
.ty-tree-edge-theyais { stroke: var(--info-ink); }
.ty-tree-edge-inventory { stroke: var(--line-control); }
.ty-tree-arrow { stroke: none; transition: opacity 0.12s; }
.ty-tree-arrow-user { fill: var(--brand-ink); }
.ty-tree-arrow-theyais { fill: var(--info-ink); }
.ty-tree-arrow-inventory { fill: var(--line-control); }
.ty-tree-halo { fill: none; stroke: var(--bg-page); stroke-width: 6; }
.ty-tree:not(.ty-tree-narrow) .ty-tree-stem::before { left: -0.75px; width: 1.5px; background: var(--brand-ink); transition: opacity 0.12s; }
.ty-tree:not(.ty-tree-narrow) .ty-tree-badge-user { border-color: var(--brand-ink); color: var(--brand-ink); }
.ty-tree-badge-theyais { border-color: var(--info-ink); color: var(--info-ink); }
.ty-tree-focus .ty-tree-edge:not(.is-hot), .ty-tree-focus .ty-tree-arrow:not(.is-hot), .ty-tree-focus .ty-tree-stem:not(.is-hot)::before { opacity: 0.35; }
.ty-tree-edge.is-hot { stroke-width: 2.5; }
.ty-tree:not(.ty-tree-narrow) .ty-tree-stem.is-hot::before { left: -1.25px; width: 2.5px; }
.ty-tree-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-6); margin: 0 0 var(--space-4); color: var(--ink-muted); }
.ty-tree-legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
.ty-tree-swatch { display: inline-block; width: 20px; height: 0; border-top: 2px solid var(--brand-ink); }
.ty-tree-swatch-theyais { border-top-color: var(--info-ink); }
.ty-tree-swatch-inventory { border-top: 2px dotted var(--line-control); }
.ty-tree-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-3) 0; }
.ty-tree-note { margin: var(--space-2) 0 0; color: var(--ink-muted); }
.ty-tree-card:focus-visible, .ty-tree-leaf:focus-visible, .ty-tree-badge:focus-visible, .ty-popover-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ty-tree-narrow .ty-tree-lower { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.ty-tree-narrow .ty-tree-col { margin-top: 0; }
.ty-tree-narrow .ty-tree-pm { flex-basis: 100%; max-width: none; }
.ty-tree-narrow .ty-tree-node { width: min(240px, 100%); }
.ty-tree-narrow .ty-tree-gap { height: var(--space-4); }
.ty-tree-narrow .ty-tree-orca { padding: var(--space-10) var(--space-5) var(--space-5); }
.ty-tree-narrow .ty-tree-orca-title { top: var(--space-3); bottom: auto; }
.ty-tree-narrow .ty-tree-pms { gap: var(--space-10) var(--space-4); }
/* 区块加载态（T-131）：首次读取时放在区块里，读取完成后被内容替换。 */
.ty-loading { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-4) 0; color: var(--ink-muted); }
/* 概览（T-132）：待你处理与项目占整行，其余三块并排；窄屏一列。 */
.ty-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "attention attention attention" "projects projects projects" "activity activity huizhiyun" "activity activity run"; grid-template-rows: auto auto auto 1fr; gap: var(--space-4); align-items: start; }
.ty-overview-attention { grid-area: attention; } .ty-overview-projects { grid-area: projects; } .ty-overview-activity { grid-area: activity; } .ty-overview-huizhiyun { grid-area: huizhiyun; } .ty-overview-run { grid-area: run; }
.ty-overview-projects .ty-card-body > .ty-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.ty-overview-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin: 0; }
@media (max-width: 899px) { .ty-overview { grid-template-columns: minmax(0, 1fr); grid-template-areas: "attention" "projects" "activity" "huizhiyun" "run"; grid-template-rows: none; } }
.ty-attention-empty { color: var(--ink-muted); }
/* 项目页（T-133）：每个项目一张卡；技术字段折叠在「技术详情」。 */
.ty-project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.ty-tech > summary { cursor: pointer; color: var(--ink-muted); }
.ty-break { word-break: break-all; }
/* 决定页（T-134）：一行一个决定，点行开抽屉；内容最多两行，回执一行。 */
.ty-row-link { cursor: pointer; }
.ty-row-link:hover { background: var(--surface-hover); }
.ty-row-link:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.ty-clamp2, .ty-clamp1 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.ty-clamp2 { -webkit-line-clamp: 2; line-clamp: 2; }
.ty-clamp1 { -webkit-line-clamp: 1; line-clamp: 1; }
.ty-break-lines { white-space: pre-wrap; }
.ty-decision-filters { gap: var(--space-4); align-items: flex-end; margin-bottom: var(--space-4); }
.ty-decision-filters .ty-field { margin-bottom: 0; min-width: 180px; }
/* 对话（T-134）：引用芯片、思考占位与示例问题。 */
.ty-cite { min-height: 0; padding: 0 var(--space-2); }
.ty-msg-thinking .ty-loading { margin: 0; }
.ty-chat-examples { justify-content: center; flex-wrap: wrap; gap: var(--space-2); }
.ty-device-actions { flex-wrap: nowrap; align-items: center; }

/* 智能体消息（M15）：发送行、「发给智能体」入口、控制台「消息」页的名录与往来。 */
.ty-compose-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-3); }
.ty-compose-row .ty-field { margin: 0; min-width: 0; }
.ty-compose-row textarea { width: 100%; }
.ty-agent-sender { margin-bottom: var(--space-3); }
.ty-agent-sender > summary { cursor: pointer; padding: var(--space-2) 0; }
.ty-relay { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 760px) { .ty-relay { grid-template-columns: minmax(0, 1fr); } }
.ty-relay-group { margin: 0 0 var(--space-3); }
.ty-relay-group > h4 { margin: 0 0 var(--space-1); }
.ty-relay-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.ty-relay-item { width: 100%; justify-content: flex-start; text-align: left; white-space: normal; height: auto; }
.ty-relay-item[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.ty-relay-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); }
.ty-relay-dot-on { background: var(--success); }
.ty-relay-thread { display: flex; flex-direction: column; gap: var(--space-3); }
.ty-relay-msg { display: flex; flex-direction: column; gap: var(--space-1); }
