/* 用例录入弹窗 — 布局与视觉升级（仅样式，不改功能） */

#left-panel.tc-left-float-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#left-panel .tc-left-float-panel__body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#left-panel .tc-entry-card {
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    background: #ffffff;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#left-panel .tc-entry-card__label {
    margin: 0 0 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: 0.01em;
    line-height: 1.35;
}

#left-panel .tc-entry-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

#left-panel .tc-entry-card__head .tc-entry-card__label {
    margin-bottom: 0;
}

#left-panel .tc-entry-card__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 蓝湖输入 — Cookie / URL 并排一行，加密展示 */
#left-panel .tc-preset-lanhu--inline {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
}

#left-panel .tc-preset-lanhu--inline .tc-preset-lanhu__field {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    grid-column: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#left-panel .tc-preset-lanhu__input-shell {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

#left-panel .tc-preset-lanhu__input-shell .tc-preset-lanhu__input,
#left-panel .tc-preset-lanhu__input-shell .tc-preset-lanhu__input.form-input {
    width: 100%;
}

#left-panel .tc-preset-lanhu__reveal-btn {
    position: absolute;
    right: 0.375rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease, color 0.15s ease, background 0.15s ease;
}

#left-panel .tc-preset-lanhu__input-shell:hover .tc-preset-lanhu__reveal-btn,
#left-panel .tc-preset-lanhu__input-shell:focus-within .tc-preset-lanhu__reveal-btn,
#left-panel .tc-preset-lanhu__reveal-btn--active,
#left-panel .tc-preset-lanhu__reveal-btn:focus-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#left-panel .tc-preset-lanhu__input-shell:hover .tc-preset-lanhu__input,
#left-panel .tc-preset-lanhu__input-shell:focus-within .tc-preset-lanhu__input,
#left-panel .tc-preset-lanhu__input-shell:has(.tc-preset-lanhu__reveal-btn--active) .tc-preset-lanhu__input,
#left-panel .tc-preset-lanhu__input-shell:hover .tc-preset-lanhu__input.form-input,
#left-panel .tc-preset-lanhu__input-shell:focus-within .tc-preset-lanhu__input.form-input,
#left-panel .tc-preset-lanhu__input-shell:has(.tc-preset-lanhu__reveal-btn--active) .tc-preset-lanhu__input.form-input {
    padding-right: 2.375rem !important;
}

#left-panel .tc-preset-lanhu__reveal-btn:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #4b5563;
}

#left-panel .tc-preset-lanhu__reveal-btn:focus-visible {
    outline: none;
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#left-panel .tc-preset-lanhu__reveal-btn--active {
    color: #4338ca;
}

#left-panel .tc-preset-lanhu__reveal-icon {
    width: 1rem;
    height: 1rem;
}

#left-panel .tc-preset-lanhu__reveal-icon.hidden {
    display: none;
}

#left-panel .tc-preset-lanhu--inline .tc-preset-lanhu__input[type="text"] {
    font-family: inherit;
    letter-spacing: normal;
}

#left-panel .tc-preset-lanhu__hint {
    display: block;
    margin: 0 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.3;
    color: #9ca3af;
    letter-spacing: 0.01em;
}

#left-panel .tc-preset-lanhu--inline .tc-preset-lanhu__deck {
    flex: 1 1 100%;
    width: 100%;
}

#left-panel .tc-preset-lanhu__input {
    background: #f9fafb;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.8125rem;
    color: #111827;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#left-panel .tc-preset-lanhu__input:hover {
    background: #f3f4f6;
}

#left-panel .tc-preset-lanhu__input:focus {
    outline: none;
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#left-panel .tc-preset-lanhu__input::placeholder {
    color: #9ca3af;
}

#left-panel .tc-preset-lanhu--inline .tc-preset-lanhu__input[type="password"] {
    font-family: inherit;
    letter-spacing: 0.08em;
}

#left-panel #tc-lanhu-tooldeck .tc-lanhu-tooldeck__status {
    font-size: 0.6875rem;
    color: #6b7280;
}

/* 生成模式 — 胶囊切换器 */
/* 生成模式 — 顶部 Tab 胶囊切换器 */
#left-panel #tc-drawer-tabs-root {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

#left-panel #tc-drawer-tabs-root #drawer-tabs {
    flex: 1 1 auto;
    min-width: 0;
}

#left-panel .tc-wb-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-right: 6px;
}

#left-panel .tc-wb-history-wrap {
    position: relative;
}

#left-panel .tc-wb-history-toggle--open {
    border-color: rgba(99, 102, 241, 0.35);
    background: #eef2ff;
    color: #4338ca;
}

#left-panel .tc-wb-new-chat-btn:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: #eef2ff;
    color: #4338ca;
}

#left-panel .tc-wb-new-chat-btn:focus-visible {
    outline: none;
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#left-panel .tc-session-nav-btn--locked,
#left-panel .tc-session-nav-btn--locked:hover,
#left-panel .tc-session-nav-btn--locked:focus-visible {
    opacity: 0.48;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

#left-panel .tc-wb-history-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    width: min(280px, calc(100vw - 24px));
    max-height: 320px;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

#left-panel .tc-wb-history-panel.hidden {
    display: none;
}

#left-panel .tc-wb-history-panel__head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

#left-panel .tc-wb-history-panel__title {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#left-panel .tc-wb-history-panel__hint {
    font-size: 0.625rem;
    color: #94a3b8;
    white-space: nowrap;
}

#left-panel .tc-wb-history-panel__new,
#left-panel .tc-wb-history-panel__close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    color: #6366f1;
    padding: 2px 6px;
    border-radius: 6px;
}

#left-panel .tc-wb-history-panel__close {
    font-size: 1rem;
    line-height: 1;
    color: #64748b;
}

#left-panel .tc-wb-history-panel__new:hover,
#left-panel .tc-wb-history-panel__close:hover {
    background: #eef2ff;
}

#left-panel .tc-wb-history-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
}

#left-panel .tc-wb-history-list__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

#left-panel .tc-wb-history-list__item:hover {
    background: #f8fafc;
}

#left-panel .tc-wb-history-list__item--active {
    background: #eef2ff;
}

#left-panel .tc-wb-history-list__title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#left-panel .tc-wb-history-list__meta {
    font-size: 0.6875rem;
    color: #64748b;
}

#left-panel .tc-wb-history-list__empty {
    padding: 16px 10px;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
}

.tc-wb-session-limit-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 13050;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.8125rem;
    line-height: 1.45;
    box-shadow: 0 10px 28px -8px rgba(146, 64, 14, 0.28);
    pointer-events: auto;
}

.tc-wb-session-limit-banner.hidden {
    display: none;
}

.tc-wb-session-limit-banner__text {
    flex: 1;
    min-width: 0;
}

.tc-wb-session-limit-banner__close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #b45309;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}

.tc-wb-session-limit-banner__close:hover {
    background: rgba(251, 191, 36, 0.25);
}

#left-panel .tc-wb-history-list__item-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

#left-panel .tc-wb-history-list__item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#left-panel .tc-wb-history-list__rename,
#left-panel .tc-wb-history-list__delete {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.6875rem;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

#left-panel .tc-wb-history-list__item:hover .tc-wb-history-list__rename,
#left-panel .tc-wb-history-list__item:hover .tc-wb-history-list__delete,
#left-panel .tc-wb-history-list__rename:focus-visible,
#left-panel .tc-wb-history-list__delete:focus-visible {
    opacity: 1;
}

#left-panel .tc-wb-history-list__rename:hover {
    background: #eef2ff;
    color: #4338ca;
}

#left-panel .tc-wb-history-list__title-input {
    width: 100%;
    box-sizing: border-box;
    padding: 2px 6px;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1e293b;
    background: #fff;
}

#left-panel .tc-wb-history-list__delete {
    background: #fef2f2;
    color: #dc2626;
}

#left-panel .tc-lanhu-section-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-right: 6px;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#left-panel .tc-lanhu-section-toggle:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

#left-panel .tc-lanhu-section-toggle:focus-visible {
    outline: none;
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#left-panel .tc-lanhu-section-toggle__icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

#left-panel .tc-lanhu-section-toggle--collapsed .tc-lanhu-section-toggle__icon {
    transform: rotate(-90deg);
}

#left-panel #ai-config-mode-root.tc-lanhu-section--collapsed {
    display: none;
}

#left-panel #drawer-tabs.tc-entry-gen-mode__seg {
    position: relative;
    display: flex;
    width: 100%;
    height: 36px;
    padding: 3px;
    border: none !important;
    border-radius: 10px;
    background: #f3f4f6;
    box-shadow: none !important;
}

#left-panel #drawer-tabs.tc-entry-gen-mode__seg::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease;
    pointer-events: none;
    z-index: 0;
}


#left-panel #drawer-tabs.tc-entry-gen-mode__seg .tc-gen-mode-btn {
    position: relative;
    z-index: 1;
    flex: 1 1 50%;
}

#left-panel .tc-entry-gen-mode__seg-wrap {
    width: 100%;
    justify-content: stretch;
    margin-bottom: 12px;
}

#left-panel #tc-gen-mode-toolbar {
    width: 100%;
    margin: 0;
}

#left-panel .tc-entry-gen-mode__seg {
    position: relative;
    display: flex;
    width: 100%;
    height: 36px;
    padding: 3px;
    border: none !important;
    border-radius: 10px;
    background: #f3f4f6;
    box-shadow: none !important;
}

#left-panel .tc-entry-gen-mode__seg::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease;
    pointer-events: none;
    z-index: 0;
}


#left-panel .tc-entry-gen-mode__seg .tc-gen-mode-btn {
    position: relative;
    z-index: 1;
    flex: 1 1 50%;
    height: 100%;
    margin: 0;
    padding: 0 12px;
    border: none !important;
    border-radius: 8px;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    transition: color 0.2s ease;
}

#left-panel .tc-entry-gen-mode__seg .tc-gen-mode-btn:hover:not(.tc-gen-mode-btn--active):not(:disabled) {
    color: #374151;
    background: transparent !important;
}

#left-panel .tc-entry-gen-mode__seg .tc-gen-mode-btn--active,
#left-panel .tc-entry-gen-mode__seg .tc-gen-mode-btn--active:hover {
    color: #6366f1 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#left-panel #tc-ai-entry-head {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

#left-panel #tc-entry-head-actions {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-width: 0;
    margin-right: 6px;
}

#left-panel #tc-entry-head-actions #tc-gen-options-row {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
}

#left-panel #tc-entry-head-actions .tc-gen-option-item {
    flex: 0 0 auto;
}

#left-panel #tc-gen-options-row {
    gap: 8px;
}

#left-panel #tc-gen-validate-option-item {
    transition: opacity 0.2s ease, transform 0.2s ease, max-width 0.2s ease;
    transform-origin: left center;
}

body.tc-workbench-gen-mode-agent #left-panel #tc-gen-validate-option-item.hidden {
    display: inline-flex !important;
    opacity: 0;
    transform: scale(0.96);
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
}

body:not(.tc-workbench-gen-mode-agent) #left-panel #tc-gen-validate-option-item:not(.hidden) {
    opacity: 1;
    transform: none;
    max-width: 20rem;
}

#left-panel .tc-gen-toggle-btn {
    border-radius: 8px;
    border-color: #e5e7eb;
    background: #f9fafb;
    color: #374151;
}

#left-panel .tc-gen-toggle-btn--on {
    border-color: rgba(99, 102, 241, 0.35);
    background: #eef2ff;
    color: #4338ca;
}

/* 执行区 */
#left-panel .tc-entry-card--execute {
    padding-bottom: 12px;
}

#left-panel .tc-entry-execute__body {
    gap: 10px;
}

#left-panel #tc-ai-generate-actions.tc-entry-card--execute {
    display: flex;
    flex-direction: column;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    background: #ffffff;
    padding: 16px;
}


/* 紧凑模式：隐藏底部执行区，Enter / 发送触发生成（含 Agent 规划） */
body.tc-left-gen-compact #tc-ai-generate-actions {
    display: none !important;
}


body.tc-left-gen-compact--mindmap #drawer-tabs.tc-entry-gen-mode__seg::before {
    display: none;
}

body.tc-left-gen-compact--mindmap #drawer-tabs.tc-entry-gen-mode__seg .tc-gen-mode-btn {
    flex: 1 1 100%;
    cursor: default;
}

body.tc-left-gen-compact #tc-prompt-composer {
    margin-bottom: 0;
}

/* 抽屉内容：蓝湖区可滚动，输入区 + 执行区固定底部 */
#left-panel .tc-left-float-panel__scroll {
    display: flex;
    flex-direction: column;
}

#left-panel .tc-left-float-panel__body.tc-left-panel {
    flex: 1 1 auto;
    min-height: 100%;
}

#left-panel #left-content-wrapper {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#left-panel #drawer-1-content.tc-drawer-1-layout {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 0;
}

#left-panel .tc-drawer-1-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
}

#left-panel .tc-gen-instruction-zone {
    position: relative;
    flex: 1 1 auto;
    min-height: clamp(11.5rem, 44vh, 20rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: #ffffff;
}

#left-panel .tc-gen-instruction-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#left-panel #ai-config-mode-root.tc-gen-lanhu-overlay:not(.tc-lanhu-section--collapsed) {
    position: absolute;
    inset: 0;
    z-index: 24;
    margin: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: none;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 16px 40px -12px rgba(15, 23, 42, 0.18);
    background: #ffffff;
}

/* 有对话时：蓝湖只占上方浮层，下方对话区仍可见（不被白底整屏盖住） */
#left-panel .tc-gen-instruction-zone--lanhu-over-chat #ai-config-mode-root.tc-gen-lanhu-overlay:not(.tc-lanhu-section--collapsed) {
    inset: auto;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    max-height: min(56%, 17.5rem);
    box-shadow: 0 10px 28px -8px rgba(15, 23, 42, 0.2);
}

#left-panel #ai-config-mode-root.tc-gen-lanhu-overlay.tc-lanhu-section--collapsed {
    display: none;
}

#left-panel #ai-config-mode-root {
    flex: 0 0 auto;
}

#left-panel .tc-gen-chat-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 0;
    background: #ffffff;
    border: none;
    border-bottom: none;
}

#left-panel .tc-gen-instruction-zone.tc-gen-lanhu-open .tc-gen-instruction-body {
    flex: 1 1 auto;
    min-height: 6.5rem;
}

/* 蓝湖展开时：对话区保留在 overlay 下层；有对话内容时下方仍可见可滚动 */
#left-panel .tc-gen-instruction-zone.tc-gen-lanhu-open .tc-gen-chat-panel {
    flex: 1 1 auto;
    min-height: 6.5rem;
    z-index: 1;
}

#left-panel .tc-gen-instruction-zone--lanhu-over-chat .tc-gen-chat-panel {
    min-height: 6.5rem;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

/* 有对话时：蓝湖 overlay 空白区穿透，让下方对话区可接收点击（表单控件仍可交互） */
#left-panel .tc-gen-instruction-zone--lanhu-over-chat #ai-config-mode-root.tc-gen-lanhu-overlay:not(.tc-lanhu-section--collapsed) {
    pointer-events: none;
}

#left-panel .tc-gen-instruction-zone--lanhu-over-chat #ai-config-mode-root.tc-gen-lanhu-overlay:not(.tc-lanhu-section--collapsed) :is(
    input,
    textarea,
    select,
    button,
    a,
    label,
    [role="button"],
    [contenteditable="true"]
) {
    pointer-events: auto;
}

#left-panel .tc-gen-instruction-zone.tc-gen-lanhu-open:not(.tc-gen-instruction-zone--lanhu-over-chat) .tc-gen-chat-panel .tc-gen-chat-thread {
    pointer-events: none;
}

#left-panel .tc-gen-instruction-zone--lanhu-over-chat .tc-gen-chat-panel .tc-gen-chat-thread {
    pointer-events: auto;
}

#left-panel .tc-gen-instruction-zone:not(.tc-gen-lanhu-open) .tc-gen-chat-panel .tc-gen-chat-thread {
    pointer-events: auto;
}

#left-panel .tc-gen-chat-panel:not(.tc-gen-chat-panel--has-messages) {
    flex: 0 1 auto;
    min-height: 0;
}

#left-panel .tc-gen-chat-panel--has-messages {
    min-height: 6.5rem;
}

#left-panel .tc-gen-chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overscroll-behavior: contain;
}

/* React 对话区：由内部 .tc-gen-chat-x-scroll 承担滚动，避免与 thread 双层滚动冲突 */
#left-panel .tc-gen-chat-thread .tc-gen-chat-x-mount {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: auto;
}

#left-panel .tc-gen-chat-msg {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    max-width: 100%;
}

#left-panel .tc-gen-chat-msg__bubble {
    max-width: min(100%, 28rem);
    padding: 0.65rem 0.85rem;
    border-radius: 14px 14px 4px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    font-size: 0.8125rem;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

#left-panel .tc-gen-chat-msg__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding-right: 0.15rem;
    font-size: 0.6875rem;
    line-height: 1;
    color: #94a3b8;
}

#left-panel .tc-gen-chat-msg__mode {
    font-weight: 500;
    color: #64748b;
}

#left-panel .tc-gen-chat-msg__time {
    font-variant-numeric: tabular-nums;
}

#left-panel .tc-gen-chat-msg--progress {
    align-items: flex-start;
}

#left-panel .tc-gen-chat-msg--progress .tc-gen-chat-msg__bubble--progress {
    max-width: min(100%, 30rem);
    border-radius: 14px 14px 14px 4px;
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #312e81;
}

#left-panel .tc-gen-chat-msg--progress-done .tc-gen-chat-msg__bubble--progress {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

#left-panel .tc-gen-chat-msg--progress-error .tc-gen-chat-msg__bubble--progress,
#left-panel .tc-gen-chat-msg--progress-cancelled .tc-gen-chat-msg__bubble--progress {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

#left-panel .tc-gen-chat-progress__step {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
}

#left-panel .tc-gen-chat-progress__step--loading::after {
    content: '…';
    display: inline-block;
    width: 0.85rem;
    margin-left: 0.05rem;
    animation: tc-gen-chat-progress-dots 1.2s steps(4, end) infinite;
}

@keyframes tc-gen-chat-progress-dots {
    0% { opacity: 0.35; }
    50% { opacity: 1; }
    100% { opacity: 0.35; }
}

#left-panel .tc-gen-chat-progress__detail {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #4338ca;
    font-variant-numeric: tabular-nums;
}

#left-panel .tc-gen-chat-msg--progress-done .tc-gen-chat-progress__detail {
    color: #047857;
}

#left-panel .tc-gen-chat-msg--progress-error .tc-gen-chat-progress__detail,
#left-panel .tc-gen-chat-msg--progress-cancelled .tc-gen-chat-progress__detail {
    color: #64748b;
}

#left-panel .tc-gen-chat-progress__detail.hidden {
    display: none !important;
}

#left-panel .tc-gen-chat-progress__cancel {
    margin-top: 0.55rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.2;
    color: #4338ca;
    background: transparent;
    border: 1px solid #a5b4fc;
    border-radius: 8px;
    cursor: pointer;
}

#left-panel .tc-gen-chat-progress__cancel:hover {
    color: #3730a3;
    border-color: #818cf8;
    background: rgb(99 102 241 / 0.06);
}

#left-panel .tc-gen-chat-progress__cancel.hidden {
    display: none !important;
}

#left-panel .tc-drawer-1-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 26;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: auto;
    padding: 0.65rem 0.85rem 0.85rem;
    background: #ffffff;
    border: none;
    border-top: 1px solid #f1f5f9;
    border-radius: 0;
}

#left-panel .tc-drawer-1-footer #tc-prompt-composer {
    margin-bottom: 0;
}

#left-panel .tc-drawer-1-footer #tc-ai-generate-actions {
    margin-bottom: 0;
}

body.tc-left-gen-compact #left-panel .tc-left-float-panel__scroll {
    padding-bottom: 8px;
}

/* 工作台初始化完成前隐藏 AI 悬浮按钮，避免先闪 FAB 再展开用例生成弹窗 */
body:not(.tc-left-gen-ui-ready) #tc-left-input-float-wrap {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 首次进入：禁用过渡，避免弹窗尺寸/透明度闪动 */
body:not(.tc-left-gen-ui-ready) #left-panel.tc-left-float-panel,
body:not(.tc-left-gen-ui-ready) #left-panel #left-content-wrapper,
body:not(.tc-left-gen-ui-ready) #tc-left-float-backdrop {
    transition: none !important;
}

#left-panel #tc-generate-preset-wrap .btn-primary {
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
    font-weight: 600;
}

#left-panel #tc-generate-preset-wrap .btn-primary:hover {
    filter: brightness(1.04);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.34);
}

#left-panel #tc-generate-preset-wrap .btn-mindmap {
    border-radius: 10px;
    font-weight: 600;
}

#left-panel .tc-entry-execute__text-btn {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #6b7280 !important;
    font-weight: 600;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

#left-panel .tc-entry-execute__text-btn:hover {
    color: #6366f1 !important;
    background: rgba(99, 102, 241, 0.06) !important;
}

#left-panel #tc-single-generate-actions {
    width: 100%;
}

#left-panel #tc-ai-form-actions-wrap {
    margin-left: auto;
    align-self: flex-end;
}

/* 智能编辑 Tab */
#tc-gen-mode-edit.tc-drawer-tab--edit {
    color: #6d28d9;
}
#tc-gen-mode-edit.tc-gen-mode-btn--active {
    color: #5b21b6;
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.35);
}

/* 智能编辑 — 会话区（独立样式，参考生成区圆角白底容器） */
#left-panel .tc-edit-instruction-zone {
    position: relative;
    flex: 1 1 auto;
    min-height: clamp(11.5rem, 44vh, 20rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: #ffffff;
}
#left-panel .tc-edit-instruction-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 智能编辑面板 */
#drawer-edit-content.tc-drawer-edit-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}
#drawer-edit-content.hidden {
    display: none !important;
}

#left-panel .tc-edit-chat-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 0;
    background: #ffffff;
    border: none;
}
#left-panel .tc-edit-chat-panel:not(.tc-edit-chat-panel--has-messages) {
    min-height: 0;
}
#left-panel .tc-edit-chat-panel--has-messages {
    min-height: 6rem;
}
#left-panel .tc-edit-chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#left-panel .tc-edit-chat-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}
#left-panel .tc-edit-chat-msg__bubble {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}
#left-panel .tc-edit-chat-msg--user .tc-edit-chat-msg__bubble {
    background: #f5f3ff;
    border-color: #ddd6fe;
}
#left-panel .tc-edit-chat-msg--assistant .tc-edit-chat-msg__bubble {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
#left-panel .tc-edit-chat-msg--progress .tc-edit-chat-msg__bubble {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
#left-panel .tc-edit-chat-msg--error .tc-edit-chat-msg__bubble,
#left-panel .tc-edit-chat-msg--assistant.tc-edit-chat-msg--error .tc-edit-chat-msg__bubble {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
#left-panel .tc-edit-chat-msg__meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: #94a3b8;
    padding: 0 4px;
}
#left-panel .tc-edit-actions-row {
    display: flex;
    justify-content: flex-end;
    padding: 0.25rem 0 0;
}
#left-panel .tc-edit-undo-btn {
    font-size: 12px;
    color: #6d28d9;
    padding: 4px 10px;
    border: 1px solid rgba(109, 40, 217, 0.25);
    border-radius: 8px;
    background: #faf5ff;
    cursor: pointer;
}
#left-panel .tc-edit-undo-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
body.tc-workbench-mode-edit #ai-config-mode-root {
    display: none !important;
}
body.tc-workbench-mode-edit #tc-gen-instruction-zone .tc-gen-chat-panel {
    display: none !important;
}
body.tc-workbench-mode-edit #tc-prompt-composer {
    display: none !important;
}
tr.tc-row--ai-edited {
    animation: tc-row-ai-edited-flash 2.5s ease-out;
}
@keyframes tc-row-ai-edited-flash {
    0% { background-color: rgba(167, 139, 250, 0.35); }
    100% { background-color: transparent; }
}


body.tc-workbench-mode-edit #tc-lanhu-section-toggle {
    display: none !important;
}

#left-panel #left-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
#drawer-edit-content .tc-drawer-1-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 26;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: auto;
    padding: 0.65rem 0.85rem 0.85rem;
    background: transparent;
    border: none;
    border-top: none;
}
#drawer-edit-content #tc-edit-prompt-composer {
    margin-bottom: 0;
}
body.tc-workbench-mode-edit #tc-edit-prompt-composer {
    display: block !important;
}
