/* ========================================
   Chat — CSS Module
   消息气泡、MOOD、Cron 确认、Compaction、工具调用、
   文件输出卡片、浏览器截图、Xing 反省卡片
   ======================================== */

/* ── 消息组 ── */

.messageGroup {
    display: flex;
    flex-direction: column;
    --slide-y: 8px;
    animation: hana-fade-up var(--duration-slow) var(--ease-out);
}

.messageGroup:first-child .avatarRow {
    margin-top: 0;
}

.messageGroupUser {
    align-items: flex-end;
    position: relative;
}

.messageGroupAssistant {
    align-items: flex-start;
    padding-left: var(--space-sm);
    margin-left: 2px;
    position: relative;
}

/* 头像行 */
.avatarRow {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: var(--space-lg);
    margin-bottom: 0.2rem;
}

.avatarRowUser {
    flex-direction: row-reverse;
}

.avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.hanaAvatar {
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

.userAvatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    font-size: 0.8rem;
    line-height: 1;
}

.avatarName {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* 单条消息 */
.message {
    max-width: 92%;
    min-width: 0;
}

.message + .message {
    margin-top: var(--space-xs);
}

/* 用户消息 */
.messageUser {
    background: rgba(0, 0, 0, 0.045);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-sm) var(--radius-md);
    color: var(--text);
    font-size: 0.95rem;
    word-break: break-word;
}

.messageUser .userText p:last-child {
    margin-bottom: 0;
}

/* 用户附件 */
.userAttachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

.userAttachments:last-child {
    margin-bottom: 0;
}

.attachCard {
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
}

.attachCard:hover {
    filter: brightness(0.96);
}

.attachImage {
    max-width: 200px;
    max-height: 150px;
    background: var(--attach-bg, rgba(0, 0, 0, 0.04));
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    object-fit: contain;
}

.attachImageWrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.visionAuxiliaryLabel {
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-muted);
}

.attachImageImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* 助手消息 */
.messageAssistant {
    color: var(--hana-text);
    font-size: 0.95rem;
    line-height: 1.75;
    word-break: break-word;
    position: relative;
}

/* 助手回答正文用宋体 */
.messageAssistant :global(.md-content) {
    font-family: var(--font-serif);
}

/* ── Message action buttons (shared by user & assistant) ── */

.msgActions {
    position: absolute;
    top: 4px;
    right: 4px;
    opacity: 0;
    transition: opacity var(--duration-fast);
    z-index: 2;
}

.msgActionsLeft {
    left: 4px;
    right: auto;
}

.msgActionsVisible { opacity: 1 !important; }

.messageGroupAssistant:hover .msgActions,
.messageGroupUser:hover .msgActions { opacity: 0.6; }
.msgActions:hover { opacity: 1 !important; }

.msgActionsPopover {
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    display: flex;
    gap: 2px;
    background: var(--hana-bg);
    border: 1px solid var(--hana-border);
    border-radius: 6px;
    padding: 2px 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast);
}

.msgActions:hover .msgActionsPopover {
    opacity: 1;
    pointer-events: auto;
}

.msgActionsLeft .msgActionsPopover {
    right: auto;
    left: 100%;
}

.msgActionBtn {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
    background: none;
    border: none;
    border-radius: 3px;
    padding: 3px;
    cursor: pointer;
    color: var(--hana-text-muted);
    line-height: 1;
    transition: color var(--duration-instant), background var(--duration-instant);
}

.msgActionBtn:hover {
    color: var(--hana-text);
    background: var(--hana-border);
}

.msgActionBtn:disabled {
    opacity: 0.3;
    cursor: default;
}

.msgActionBtnActive {
    color: var(--accent) !important;
    background: rgba(var(--accent-rgb), 0.10);
    opacity: 1;
}

.msgActionBtnCopied {
    color: var(--accent) !important;
}

.msgActionBadge {
    font-size: 0.6rem;
    min-width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    background: var(--accent);
    color: #fff;
    border-radius: 7px;
    padding: 0 3px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 选中消息的视觉提示 */
.messageGroupSelected {
    background: var(--accent-light);
    border-radius: 4px;
}

/* ── MOOD / PULSE / REFLECT ── */

.moodWrapper {
    --mood-accent: var(--accent);
    margin: var(--space-xs) 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.8rem;
}

.moodWrapper[data-yuan="hanako"] { --mood-accent: var(--accent); }
.moodWrapper[data-yuan="butter"]  { --mood-accent: #5BA88C; }
.moodWrapper[data-yuan="ming"]    { --mood-accent: #8BA4B4; }

.moodSummary {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    color: var(--mood-accent);
    opacity: 0.6;
    font-style: italic;
    user-select: none;
    list-style: none;
}

.moodSummary::-webkit-details-marker {
    display: none;
}

.moodArrow {
    display: inline-block;
    font-style: normal;
    font-size: 0.75rem;
    transition: transform var(--duration-fast) ease;
}

.moodArrowOpen {
    transform: rotate(90deg);
}

.moodBlock {
    margin-top: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    border-left: 2px solid var(--mood-accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    opacity: 0.7;
}

/* ── Cron 确认卡片 ── */

.cronConfirmCard {
    margin: var(--space-sm) 0;
    padding: var(--space-md);
    background: var(--bg-card, #fff);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-size: 0.82rem;
    width: fit-content;
    max-width: 360px;
}

.cronConfirmTitle {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.cronConfirmMeta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.cronConfirmPrompt {
    margin-top: var(--space-xs);
    color: var(--text-light);
    font-size: 0.75rem;
    font-style: italic;
    line-height: 1.4;
}

.cronConfirmActions {
    margin-top: var(--space-sm);
    display: flex;
    gap: var(--space-xs);
}

.cronConfirmBtn {
    padding: 3px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.cronConfirmBtn:hover { opacity: 0.85; }
.cronConfirmBtn:disabled { opacity: 0.5; cursor: default; }

.cronConfirmBtnApprove {
    background: var(--accent);
    color: #fff;
}

.cronConfirmBtnReject {
    background: var(--overlay-medium);
    color: var(--text-light);
}

.cronConfirmStatus {
    margin-top: var(--space-xs);
    font-size: 0.75rem;
    font-style: italic;
}

.cronConfirmStatusApproved { color: var(--green); }
.cronConfirmStatusRejected { color: var(--text-muted); }

/* ── 设置确认卡片 ── */

.settingsConfirmCard {
    margin: var(--space-md) 0;
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    background: var(--bg-card, #fff);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-size: 0.88rem;
    min-width: 320px;
    max-width: 420px;
}

.settingsConfirmCardDone {
    padding: var(--space-md);
}

.settingsConfirmHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.settingsConfirmLabel {
    font-weight: 600;
    font-size: 1.35rem;
    color: var(--text);
}

.settingsConfirmDesc {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 2px;
    line-height: 1.4;
}

.settingsConfirmNote {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

.settingsConfirmControl {
    margin: var(--space-md) 0;
}

.settingsConfirmOptions {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--overlay-light, rgba(0,0,0,0.03));
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    max-height: 240px;
    overflow-y: auto;
}

.settingsConfirmOption {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--hana-text);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--overlay-light, rgba(0,0,0,0.06));
    text-align: left;
    transition: background var(--duration-instant);
}

.settingsConfirmOption:last-child {
    border-bottom: none;
}

.settingsConfirmOption:hover {
    background: var(--overlay-light, rgba(0,0,0,0.04));
}

.settingsConfirmOptionSelected {
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    border-bottom-color: transparent;
}

.settingsConfirmInput {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--hana-border);
    border-radius: var(--radius-sm);
    background: var(--hana-bg);
    color: var(--hana-text);
    font-size: 0.85rem;
    font-family: inherit;
    box-sizing: border-box;
}

.settingsConfirmInput:focus {
    outline: none;
    border-color: var(--accent);
}

.settingsConfirmActions {
    margin-top: var(--space-md);
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

.settingsConfirmBtn {
    padding: 7px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--duration-fast), box-shadow var(--duration-fast);
}

.settingsConfirmBtn:hover { opacity: 0.9; }

.settingsConfirmBtnConfirm {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.settingsConfirmBtnConfirm:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.settingsConfirmBtnReject {
    background: var(--overlay-medium);
    color: var(--text-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.settingsConfirmStatus {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.92rem;
    padding: var(--space-xs) 0;
    color: var(--text-muted);
}

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

/* ── 工具调用折叠组 ── */

.toolGroup {
    margin: var(--space-xs) 0;
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--tool-bg);
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
}

.toolGroupSummary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    color: var(--tool-text);
    line-height: 1.5;
    user-select: none;
}

.toolGroupSummaryClickable {
    cursor: pointer;
}

.toolGroupSummaryClickable:hover {
    background: var(--overlay-subtle);
}

.toolGroupTitle {
    flex: 1;
}

.toolGroupArrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 0.8em;
    flex-shrink: 0;
}

.toolGroupContent {
    padding: 0 0.75rem 0.3rem;
}

.toolGroupContentCollapsed {
    display: none;
}

/* 单条工具时隐藏标题行 */
.toolGroupSingle .toolGroupSummary {
    display: none;
}

.toolGroupSingle .toolGroupContent {
    padding: 0;
}

/* ── 工具调用指示器 ── */

.toolIndicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--tool-text);
    padding: 0.2rem 0;
    line-height: 1.5;
    max-width: 400px;
}

.toolGroupSingle .toolIndicator {
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
}

.toolDesc {
    flex-shrink: 0;
}

.toolDetail {
    flex: 1;
    min-width: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolDetailLink {
    cursor: pointer;
    transition: color var(--duration-fast);
}

.toolDetailLink:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.toolTag {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--overlay-subtle);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.toolDots {
    display: inline-block;
    margin-left: auto;
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.toolDots::after {
    content: '';
    animation: hana-typewriter-dots 1.4s steps(1, end) infinite;
}

.toolStatus {
    margin-left: auto;
    font-size: 0.82rem;
}

.toolStatusDone {
    color: var(--green);
}

.toolStatusFailed {
    color: var(--coral);
}

/* ── 思考折叠块 ── */

.thinkingBlock {
    margin: var(--space-xs) 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.8rem;
}

.thinkingBlockSummary {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    color: var(--text-muted);
    font-style: italic;
    user-select: none;
    list-style: none;
}

.thinkingBlockSummary::-webkit-details-marker {
    display: none;
}

.thinkingBlockSummary .thinkingDots {
    display: inline-block;
    margin-left: 4px;
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: 0.1em;
}

.thinkingBlockSummary .thinkingDots::after {
    content: '';
    animation: hana-typewriter-dots 1.4s steps(1, end) infinite;
}

.thinkingBlockArrow {
    display: inline-block;
    font-style: normal;
    font-size: 0.75rem;
    transition: transform var(--duration-fast) ease;
}

.thinkingBlockArrowOpen {
    transform: rotate(90deg);
}

.thinkingBlockBody {
    margin-top: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    border-left: 2px solid var(--border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── 文件输出卡片 ── */

.fileOutputCard {
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 300px;
    max-width: 420px;
    margin: var(--space-sm) 0;
    padding: 0.7rem 0.9rem;
    background: var(--bg-card, var(--bg));
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: background var(--duration-fast), border-color var(--duration-fast);
}

.fileOutputPreviewable:hover {
    border-color: var(--text-muted, rgba(0,0,0,0.2));
}

.fileOutputExpired {
    border-style: dashed;
    background: var(--overlay-subtle, rgba(0,0,0,0.03));
    box-shadow: none;
    opacity: 0.82;
}

.fileOutputIcon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-subtle, rgba(0,0,0,0.03));
    border-radius: var(--radius-sm);
}

.fileOutputInfo {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fileOutputName {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fileOutputType {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.fileOutputOpen {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: auto;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--duration-fast), background var(--duration-fast), border-color var(--duration-fast);
}

.fileOutputOpen:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--overlay-light, rgba(0,0,0,0.04));
}

/* ── 图片输出卡片 ── */

.imageOutputCard {
    display: inline-flex;
    flex-direction: column;
    max-width: 100%;
    margin: var(--space-sm) 0;
    padding: 0.3rem;
    background: var(--bg-card, var(--bg));
    border: 0.5px solid var(--border, rgba(0,0,0,0.08));
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: border-color var(--duration-fast);
}

.imageOutputCard:hover {
    border-color: var(--text-muted, rgba(0,0,0,0.2));
}

.imageOutputPreview {
    display: block;
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
    border-radius: calc(var(--radius-lg) - 0.35rem);
}

.imageOutputName {
    padding: 0.35rem 0.2rem 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── 聊天气泡中的 Legacy Artifact 兼容卡片 ── */

.legacyArtifactCard {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-xs) 0;
    padding: 0.55rem 0.85rem;
    background: var(--tool-bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    max-width: 100%;
    cursor: pointer;
    transition: background var(--duration-fast), box-shadow var(--duration-fast);
}

.legacyArtifactCard:hover {
    background: var(--accent-light);
    box-shadow: 0 2px 8px var(--shadow);
}

.legacyArtifactExpiredBadge {
    flex-shrink: 0;
    margin-left: var(--space-xs);
    font-size: 0.68rem;
    color: var(--text-muted);
}

.legacyArtifactCardIcon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.legacyArtifactCardIcon svg {
    width: 16px;
    height: 16px;
}

.legacyArtifactCardInfo {
    overflow: hidden;
}

.legacyArtifactCardTitle {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legacyArtifactCardType {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── 浏览器截图 ── */

.browserScreenshot {
    margin: 8px 0;
    max-width: 600px;
}

.browserScreenshot img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.browserScreenshot img:hover {
    opacity: 0.9;
}

/* ── Skill 卡片（复用 legacy artifact 样式） ── */

.skillCard {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-xs) 0;
    padding: 0.55rem 0.85rem;
    background: var(--tool-bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    max-width: 100%;
    cursor: pointer;
    transition: background var(--duration-fast), box-shadow var(--duration-fast);
}

.skillCard:hover {
    background: var(--accent-light);
    box-shadow: 0 2px 8px var(--shadow);
}

/* ── Session Panel ── */

.sessionShell {
    --chat-scrollbar-bottom-inset: calc(var(--input-card-h, 0px) / 2);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--input-card-h, 0px) / 2 + var(--space-lg));
    overflow: hidden;
}

.sessionPanel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 76px var(--space-lg) 0;
}

/* 静默滚动条：默认 thumb 透明（track 已是 transparent），hover 或正在滚动时才显色。
   不改宽度，避免布局抖动。is-scrolling class 由 Panel 的 scroll handler 在滚动时打上、800ms 无滚动后摘掉。 */
.sessionPanel::-webkit-scrollbar-track {
    margin-bottom: var(--chat-scrollbar-bottom-inset);
}

.sessionPanel::-webkit-scrollbar-thumb {
    background: transparent;
    transition: background var(--duration-slow) ease-out;
}

.sessionPanel:hover::-webkit-scrollbar-thumb,
.sessionPanel.is-scrolling::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.25);
}

.sessionMessages {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.timelineNav {
    position: absolute;
    top: 76px;
    right: 0;
    height: 50%;
    width: 64px;
    z-index: 4;
    overflow: visible;
    --timeline-card-width: min(176px, calc(100vw - 96px));
    --timeline-marker-right: 8px;
    --timeline-row-height: 28px;
    --timeline-card-pad-y: 0.375rem;
    --timeline-marker-pad-left: 0.75rem;
    --timeline-marker-pad-right: 0.375rem;
    --timeline-marker-gap: 0.375rem;
    --timeline-card-surface-outset-right: 0.25rem;
}

.timelineCard {
    position: absolute;
    top: 50%;
    right: var(--timeline-marker-right);
    width: var(--timeline-card-width);
    height: calc(var(--timeline-visible-rows) * var(--timeline-row-height) + 2 * var(--timeline-card-pad-y));
    max-height: calc(10 * var(--timeline-row-height) + 2 * var(--timeline-card-pad-y));
    transform: translateY(-50%);
    border-radius: var(--radius-card);
    pointer-events: none;
    overflow: visible;
}

.timelineCard::before {
    content: "";
    position: absolute;
    inset: 0 calc(-1 * var(--timeline-card-surface-outset-right)) 0 0;
    border: 1px solid var(--border);
    border-radius: inherit;
    background: var(--bg-card, var(--bg));
    box-shadow: 0 10px 28px var(--shadow);
    opacity: 0;
    transform: scale(0.985);
    transform-origin: center;
    transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
    pointer-events: none;
}

.timelineList {
    position: relative;
    z-index: 1;
    height: 100%;
    padding-block: var(--timeline-card-pad-y);
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.timelineList::-webkit-scrollbar {
    display: none;
}

.timelineMarker {
    position: relative;
    width: 100%;
    height: var(--timeline-row-height);
    border: none;
    background: transparent;
    color: rgba(var(--accent-rgb), 0.52);
    cursor: pointer;
    padding: 0 var(--timeline-marker-pad-right) 0 var(--timeline-marker-pad-left);
    opacity: 0;
    pointer-events: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: center;
    gap: var(--timeline-marker-gap);
    transition: opacity var(--duration-fast) var(--ease-out), color var(--duration-instant) var(--ease-out);
    --timeline-marker-width: 0.5em;
}

.timelineNav:hover .timelineMarker,
.timelineNav:focus-within .timelineMarker {
    opacity: 1;
    pointer-events: auto;
}

.timelineNavExpanded .timelineCard,
.timelineNavExpanded .timelineLabel {
    pointer-events: auto;
}

.timelineNavExpanded .timelineLabel {
    opacity: 1;
}

.timelineNavExpanded .timelineCard::before {
    opacity: 1;
    transform: scale(1);
}

.timelineLine {
    justify-self: end;
    width: var(--timeline-marker-width);
    min-width: 0.5em;
    max-width: 1em;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.74;
    transition: opacity var(--duration-instant) var(--ease-out);
}

.timelineMarker:hover .timelineLine,
.timelineMarker:focus-visible .timelineLine,
.timelineMarkerActive .timelineLine {
    opacity: 1;
}

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

.timelineMarker:focus-visible {
    outline: none;
}

.timelineLabel {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    opacity: 0;
    pointer-events: none;
    color: var(--text-light);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    line-height: 1.4;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.timelineMarkerActive .timelineLabel {
    color: var(--accent);
}

.loadMoreHint {
    text-align: center;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    color: var(--text-tertiary, #999);
    min-height: 1.5rem;
}

.sessionFooter {
    /* 和 sessionPanel 的切点对齐：遮挡发生在输入卡片中部，同时在滚到底时额外多留约三行呼吸空间。 */
    height: calc(var(--input-card-h, 0px) / 2 + var(--space-lg) + 8rem);
    flex-shrink: 0;
}

/* ── Typing indicator (streaming 等待) ── */

.typingIndicator {
    padding: 0.2rem 0 0.6rem;
    padding-left: calc(var(--space-sm) + 2px);
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 0.6;
    letter-spacing: 0.08em;
    color: var(--accent);
    --slide-y: 8px;
    animation: hana-fade-up var(--duration-slow) var(--ease-out);
}

.typingIndicator::after {
    content: '';
    animation: hana-typewriter-dots 1.4s steps(1, end) infinite;
}

/* ── Scroll to bottom FAB ── */

.scrollToBottomFab {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-light, rgba(0,0,0,0.08));
    background: var(--bg-card, #fff);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: opacity var(--duration-fast), box-shadow var(--duration-fast);
    opacity: 0.85;
}

.scrollToBottomFab:hover {
    opacity: 1;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.06);
}

.scrollToBottomFab svg {
    display: block;
}

/* ── Subagent 实时卡片（对齐 cronConfirmCard 风格） ── */

.subagentCard {
    --subagent-preview-height: 260px;
    margin: var(--space-sm) 0;
    background: var(--bg-card, #fff);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    width: 420px;
    max-width: 90%;
    font-size: 0.82rem;
    overflow: hidden;
}

.subagentCardHeader {
    display: flex;
    align-items: stretch;
    transition: background var(--duration-fast) ease;
}

.subagentCardHeader:hover {
    background: rgba(0, 0, 0, 0.02);
}

.subagentCardButton {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}

.subagentCardButton:focus-visible {
    outline: 1px solid rgba(0, 0, 0, 0.18);
    outline-offset: -1px;
}

.subagent-running .subagentAvatar {
    --pulse-lo: 1;
    --pulse-hi: 0.6;
    animation: hana-pulse 2s ease-in-out infinite;
}

.subagentStatus {
    font-weight: normal;
    font-size: 0.75rem;
    margin-left: 6px;
    color: var(--text-muted);
}

.subagent-done .subagentStatus {
    color: #7a9e7a;
}

.subagent-failed .subagentStatus {
    color: #a67272;
}

.subagentAbortBtn {
    align-self: center;
    margin-right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.subagentCardHeader:hover .subagentAbortBtn {
    opacity: 1;
}

.subagentAbortBtn:hover {
    color: #a67272;
    background: transparent;
}

.subagent-aborted .subagentStatus {
    color: var(--text-muted);
}

.subagentAvatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.subagentBody {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.subagentName {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.subagentDisplay {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.3;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.subagentPreviewWrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-fast) cubic-bezier(0.33, 1, 0.68, 1);
    border-top: 1px solid transparent;
}

.subagentPreviewWrapOpen {
    max-height: calc(var(--subagent-preview-height) + 22px);
    border-top-color: rgba(0, 0, 0, 0.06);
}

.subagentPreviewWrapClosing {
    border-top-color: rgba(0, 0, 0, 0.06);
}

.subagentPreviewScroll {
    height: var(--subagent-preview-height);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 12px 0;
    opacity: 0;
    transform: translateY(-6px);
    transition: padding var(--duration-fast) cubic-bezier(0.33, 1, 0.68, 1), opacity 140ms ease, transform var(--duration-fast) cubic-bezier(0.33, 1, 0.68, 1);
}

.subagentPreviewWrapOpen .subagentPreviewScroll,
.subagentPreviewWrapClosing .subagentPreviewScroll {
    padding: 10px 12px 12px;
    opacity: 1;
    transform: translateY(0);
}

.subagentPreviewTranscript {
    font-size: 0.82rem;
}

.subagentPreviewTranscript .messageGroup {
    animation: none;
}

.subagentPreviewTranscript .messageGroupAssistant {
    padding-left: 0;
    margin-left: 0;
}

.subagentPreviewTranscript .avatarRow {
    margin-top: var(--space-md);
    margin-bottom: 0.1rem;
    gap: 0.35rem;
}

.subagentPreviewTranscript .avatar {
    width: 26px;
    height: 26px;
}

.subagentPreviewTranscript .avatarName {
    font-size: 0.68rem;
}

.subagentPreviewTranscript .message {
    max-width: 100%;
}

.subagentPreviewTranscript .messageUser,
.subagentPreviewTranscript .messageAssistant {
    font-size: 0.82rem;
}

.subagentPreviewTranscript .messageAssistant {
    line-height: 1.62;
}

.subagentIcon {
    margin-right: 4px;
}
