.session-preview.active {
    box-shadow: var(--shadow-float);
}

.session-preview-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 52px;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.session-preview-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.session-preview-header {
    padding: 14px var(--spacing-sm);
    border-bottom: 1px solid var(--color-border-soft);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-sm);
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-surface-elevated);
    backdrop-filter: blur(12px);
}

.session-preview-header > div:first-child {
    min-width: 0;
    flex: 1;
}

.session-preview-title {
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-title);
    color: var(--color-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.session-preview-sub {
    margin-top: 4px;
    font-size: var(--font-size-caption);
    color: var(--color-text-tertiary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-preview-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}

.session-preview-meta-item {
    font-size: var(--font-size-caption);
    color: var(--color-text-tertiary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-preview-meta-item:not(:last-child)::after {
    content: "·";
    margin: 0 6px;
    color: var(--color-text-tertiary);
    opacity: 0.7;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    max-width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.session-preview-body {
    flex: 1;
    min-height: 0;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.session-preview-messages {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    contain: layout style;
}

.session-timeline {
    position: absolute;
    top: var(--session-preview-header-offset, 72px);
    right: 4px;
    bottom: 12px;
    width: 44px;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-card);
    padding: 6px 4px 28px;
    z-index: 3;
}

.session-timeline-track {
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 32px;
    width: 2px;
    transform: translateX(-50%);
    background: var(--color-border-soft);
    border-radius: 999px;
}

.session-timeline-node {
    position: absolute;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    transform: translate(-50%, -50%);
    cursor: pointer;
    padding: 0;
    transition: border-color var(--transition-fast) var(--ease-spring), background var(--transition-fast) var(--ease-spring), box-shadow var(--transition-fast) var(--ease-spring);
}

.session-timeline-node:hover {
    border-color: var(--color-brand);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(210, 107, 90, 0.15);
}

.session-timeline-node.active {
    border-color: var(--color-brand);
    background: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(210, 107, 90, 0.2);
}

.session-timeline-current {
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: 4px;
    font-size: 10px;
    line-height: 1.2;
    color: var(--color-text-tertiary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-msg {
    border-radius: var(--radius-md);
    padding: 10px 14px 10px 20px;
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface);
    position: relative;
    box-shadow: var(--shadow-subtle);
    contain: layout style paint;
}

.session-msg.user {
    border-color: rgba(210, 107, 90, 0.3);
    background: rgba(210, 107, 90, 0.05);
}

.session-msg::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 999px;
    background: var(--color-border-soft);
}

.session-msg.user::before {
    background: var(--color-brand);
}

.session-msg.assistant::before {
    background: rgba(90, 139, 106, 0.5);
}

.session-msg-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-xs);
    margin-bottom: 6px;
    font-size: var(--font-size-caption);
    color: var(--color-text-tertiary);
}

.session-msg-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-msg-role {
    font-weight: var(--font-weight-secondary);
    color: var(--color-text-secondary);
}

.session-msg-time {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-tertiary);
}

.session-msg-content {
    font-size: var(--font-size-secondary);
    line-height: 1.6;
    color: var(--color-text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.session-preview-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-secondary);
    padding: var(--spacing-md);
    text-align: center;
    flex-direction: column;
    gap: 8px;
}

.session-preview-empty::before {
    content: "";
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-brand-dark) 100%);
    opacity: 0.18;
}

@media (max-width: 1100px) {
    .session-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .session-toolbar {
        grid-template-columns: 1fr;
    }

    .session-toolbar-actions {
        justify-content: flex-start;
    }

    .session-toolbar-footer {
        justify-content: flex-start;
    }

    .session-list {
        position: static;
        max-height: 300px;
        height: auto;
    }

    .session-preview {
        min-height: 360px;
        max-height: none;
        height: auto;
        position: relative;
        transform: none;
        box-shadow: var(--shadow-card);
    }

    .session-preview-scroll {
        padding-right: 0;
    }

    .session-timeline {
        display: none;
    }

    .session-preview-header {
        flex-direction: column;
        align-items: stretch;
    }

    .session-actions {
        justify-content: flex-start;
    }

    .session-preview.active {
        box-shadow: var(--shadow-float);
    }
}

@media (max-width: 520px) {
    .session-item-header {
        flex-direction: column;
        align-items: stretch;
    }

    .session-item-actions {
        justify-content: flex-end;
    }

    .session-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .btn-session-refresh,
    .btn-session-export {
        width: 100%;
    }

    .session-toolbar-group.session-toolbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .session-toolbar-group.session-toolbar-actions .btn-tool {
        width: 100%;
    }

    .trash-item-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .trash-item-mainline {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .trash-item-side {
        width: 100%;
        min-width: 0;
        align-items: stretch;
        gap: 10px;
    }

    .trash-item-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: flex-start;
        width: 100%;
    }

    .trash-item-actions .btn-mini {
        width: 100%;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .trash-item-time {
        text-align: right;
    }
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

