/**
 * Scene Center - Command Control Aesthetic
 * 场景中心页面样式
 */

/* ============================================
   SCENE CENTER LAYOUT
   ============================================ */
.scene-center {
    padding: 24px 32px;
    min-height: 100%;
    background: var(--bg-primary);
}

.scene-center-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.scene-center-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.scene-center-title h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.scene-center-title-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.scene-center-stats {
    display: flex;
    gap: 24px;
}

.scene-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.scene-stat-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.scene-stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ============================================
   SCENE CARDS GRID
   ============================================ */
.scene-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

/* ============================================
   SCENE CARD V2 - REDESIGNED (VERTICAL GOLDEN RATIO)
   ============================================ */
.scene-cards-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 320px));
    gap: 20px;
    justify-content: start;
}

.scene-card-v2 {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    /* 黄金比例的纵向卡片 */
    min-height: 420px;
}

.scene-card-v2:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

/* 场景卡片拖拽排序样式 */
.scene-card-v2[draggable="true"] {
    cursor: grab;
}

.scene-card-v2[draggable="true"]:active {
    cursor: grabbing;
}

.scene-card-v2.is-dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.scene-card-v2.is-drop-target {
    border: 2px dashed var(--primary);
    background: rgba(59, 130, 246, 0.05);
    transform: scale(1.02);
}

.scene-card-v2.is-drop-target::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(59, 130, 246, 0.08);
    z-index: 1;
    pointer-events: none;
    border-radius: 14px;
}

/* 运行中的场景不可拖拽 */
.scene-card-v2.is-running[draggable="false"] {
    cursor: not-allowed;
}

.scene-card-accent {
    height: 4px;
    width: 100%;
    transition: height 0.2s ease;
}

.scene-card-v2.is-running .scene-card-accent {
    height: 6px;
    background: linear-gradient(90deg, var(--primary), #06B6D4, var(--primary)) !important;
    background-size: 200% 100%;
    animation: accentFlow 2s linear infinite;
}

@keyframes accentFlow {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Card Top - Identity & Tools */
.scene-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 16px 14px;
}

.scene-card-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.scene-card-icon-v2 {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.scene-card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.scene-card-title-row .scene-card-title {
    margin-bottom: 0;
}

.scene-plan-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #0f5132;
    background: color-mix(in srgb, var(--success) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 45%, transparent);
}

/* ============================================
   SCENE TRIGGER UI
   Purple/indigo semantic color scheme (#6366f1).
   Input tokens mirror .scene-schedule-field inputs exactly.
   ============================================ */

/* --- Badge --- */

/* Pill badge matching .scene-plan-badge structure; indigo palette. */
.scene-trigger-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #4338ca;
    background: color-mix(in srgb, #6366f1 18%, transparent);
    border: 1px solid color-mix(in srgb, #6366f1 40%, transparent);
}

/* --- Section title modifier --- */

/* Extends .scene-edit-section-title; pushes "添加条件" btn to the right. */
.scene-edit-section-title--trigger {
    justify-content: space-between;
}

/* --- Add-condition ghost button --- */

.scene-trigger-add-btn {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    line-height: 1.4;
}

.scene-trigger-add-btn:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

/* --- Empty state --- */

.scene-trigger-empty {
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 16px 0 8px;
}

/* --- Condition row --- */

.scene-trigger-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* --- Enable toggle label --- */

.scene-trigger-enable {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.scene-trigger-enable input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

.scene-trigger-pk-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    white-space: nowrap;
}

/* --- Base input — mirrors .scene-schedule-field input/select tokens exactly --- */

.scene-trigger-input {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    flex: 1;
    min-width: 0;
    height: auto;
}

.scene-trigger-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* --- Select variant: fixed width, extends .scene-trigger-input --- */

.scene-trigger-select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    flex: 0 0 auto;
    min-width: 130px;
    height: auto;
    cursor: pointer;
}

.scene-trigger-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* --- Small input variant --- */

.scene-trigger-input--sm {
    flex: 0 0 80px;
    min-width: 80px;
}

/* --- Extra-small input variant (numeric, centered) --- */

.scene-trigger-input--xs {
    flex: 0 0 52px;
    min-width: 52px;
    padding: 8px 6px;
    text-align: center;
}

/* --- Interval unit label --- */

.scene-trigger-interval-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Remove / delete button --- */

.scene-trigger-remove-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.scene-trigger-remove-btn:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

/* --- Advisory hint block --- */

.scene-trigger-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
    line-height: 1.5;
}

.scene-trigger-hint strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* --- Trigger block: wraps row + conditions --- */

.scene-trigger-block {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bg-secondary) 50%, transparent);
    border: 1px solid var(--border-light);
}

.scene-trigger-block .scene-trigger-row {
    margin-bottom: 0;
}

/* --- Field conditions area --- */

.scene-trigger-conditions {
    margin-top: 8px;
    padding-left: 36px; /* align with trigger row content after remove btn */
}

.scene-trigger-cond-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.scene-trigger-cond-field {
    flex: 1;
    min-width: 120px !important;
}

.scene-trigger-cond-op {
    flex: 0 0 auto;
    min-width: 80px !important;
}

.scene-trigger-cond-remove {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.scene-trigger-cond-remove:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.scene-trigger-cond-add {
    font-size: 12px;
    color: var(--text-tertiary);
    background: transparent;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    cursor: pointer;
    margin-top: 4px;
    transition: all var(--transition-fast);
}

.scene-trigger-cond-add:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.scene-card-schedule {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.scene-card-trigger-info {
    font-size: 11px;
    color: color-mix(in srgb, var(--primary) 80%, var(--text-tertiary));
    margin-top: 1px;
}

.schedule-indicator {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-medium);
}

.schedule-indicator.cron {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.schedule-indicator.daily,
.schedule-indicator.weekly,
.schedule-indicator.date,
.schedule-indicator.scheduled {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.scene-card-tools {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.scene-card-v2:hover .scene-card-tools {
    opacity: 1;
}

.scene-tool-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.scene-tool-btn svg {
    width: 14px;
    height: 14px;
}

.scene-tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.scene-tool-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Agent List Display (Vertical) */
.scene-agents-list-v2 {
    padding: 0 16px 16px;
    flex: 1;
}

.agents-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.agents-list-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agents-list-count {
    font-size: 11px;
    color: var(--text-tertiary);
}

.agents-list-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.agent-list-row:hover {
    background: var(--bg-hover);
}

.agent-list-row.is-current {
    background: var(--primary-light);
    border-color: var(--primary);
}

.agent-list-row.is-current .agent-list-icon {
    animation: pulseIcon 1.5s ease-in-out infinite;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.agent-list-row.is-next {
    border-color: var(--warning);
    border-style: dashed;
}

.agent-list-row.is-done {
    opacity: 0.55;
}

.agent-list-row.is-skipped {
    opacity: 0.4;
}

.agent-list-row.is-skipped .agent-list-icon {
    filter: grayscale(1);
}

.agent-order {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.agent-list-row.is-current .agent-order {
    background: var(--primary);
    color: white;
}

.agent-list-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.agent-list-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.agent-list-status {
    flex-shrink: 0;
}

.status-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.status-tag.current {
    background: var(--primary);
    color: white;
}

.status-tag.next {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-tag.done {
    color: var(--success);
}

.status-tag.skipped {
    background: var(--bg-tertiary);
    color: var(--text-quaternary, #aaa);
}

/* 智能体预览数量 */
.agent-preview-count {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    padding: 2px 8px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 10px;
}

.agent-preview-count.no-data {
    color: var(--text-quaternary, #aaa);
    background: transparent;
}

.agent-preview-count.report-preview {
    white-space: pre-line;
    line-height: 1.4;
    text-align: left;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
}

.agents-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px dashed var(--border-light);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.agents-expand-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.agents-expand-btn svg {
    transition: transform 0.2s ease;
}

.agents-expand-btn svg.rotated {
    transform: rotate(180deg);
}

/* Execution Zone */
.scene-execution-zone {
    padding: 0 16px 16px;
}

.execution-progress-area {
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(6, 182, 212, 0.08) 100%);
    border: 1px solid var(--primary);
    border-radius: 10px;
}

/* Date badge shown during execution */
.progress-date-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.progress-date-badge svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.progress-date-detail {
    color: var(--text-secondary);
    margin-left: 2px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.progress-value {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

.progress-phase-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.progress-phase-label {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-phase-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.tailing-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    opacity: 0.8;
}

.progress-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #06B6D4);
    border-radius: 3px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-item {
    font-size: 11px;
    font-weight: 500;
}

.stat-item.done { color: var(--success); }
.stat-item.active { color: var(--primary); }
.stat-item.wait { color: var(--text-tertiary); }
.stat-item.fail { color: var(--danger); }

/* 多智能体并行进度 */
.agent-progress-item {
    margin-bottom: 6px;
}
.agent-progress-item .progress-header {
    margin-bottom: 4px;
}
.agent-progress-item .progress-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}
.agent-progress-item .progress-bar-track {
    margin-bottom: 6px;
}

/* Idle State */
.idle-state {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.last-run-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.last-run-info svg {
    flex-shrink: 0;
}

.date-selector-inline {
    position: relative;
}

.date-selector-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.date-selector-trigger:hover {
    border-color: var(--primary);
    background: var(--bg-primary);
}

/* Card Actions */
.scene-card-actions-v2 {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

.action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2563EB 100%);
    color: white;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3);
}

.action-btn.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(59, 130, 246, 0.4);
}

.action-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Split Button Group */
.split-btn-group {
    display: flex;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3);
}

.split-btn-main {
    flex: 1;
    border-radius: 10px 0 0 10px !important;
    box-shadow: none !important;
}

.split-btn-arrow {
    width: 38px;
    min-width: 38px;
    padding: 0 !important;
    border-radius: 0 10px 10px 0 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-btn-arrow:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%) !important;
}

.split-btn-group:hover {
    box-shadow: 0 5px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.split-btn-group:has(button:disabled) {
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.15);
    transform: none;
}

.action-btn.danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.3);
}

.action-btn.danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(239, 68, 68, 0.4);
}

/* Date Dropdown Popover */
.date-dropdown-popover {
    position: fixed;
    z-index: 1000;
    min-width: 260px;
    max-height: calc(100vh - 40px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: dropdownEnter 0.2s ease;
    overflow-y: auto;
}

@keyframes dropdownEnter {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-header {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
}

.dropdown-options {
    padding: 8px;
}

.dropdown-section-label {
    padding: 10px 12px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-section-label:not(:first-child) {
    margin-top: 4px;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}

.dropdown-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropdown-option:hover {
    background: var(--bg-hover);
}

.dropdown-option.active {
    background: var(--primary-light);
}

.dropdown-option.active .option-label {
    color: var(--primary);
    font-weight: 600;
}

.option-label {
    font-size: 13px;
    color: var(--text-primary);
}

.option-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 10px;
}

.dropdown-custom-date {
    padding: 8px 16px 12px;
    border-top: 1px solid var(--border-light);
}

.dropdown-custom-date label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    margin-top: 10px;
}

.dropdown-custom-date label:first-child {
    margin-top: 0;
}

.dropdown-custom-date input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.dropdown-custom-date input:focus {
    outline: none;
    border-color: var(--primary);
}

.dropdown-preview {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-light);
}

.dropdown-preview.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.preview-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.preview-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.preview-agent {
    font-size: 12px;
    color: var(--text-secondary);
}

.preview-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.preview-count.zero {
    color: var(--text-tertiary);
}

.preview-count.error {
    color: var(--danger);
    font-weight: normal;
}

.dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

.dropdown-confirm-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropdown-confirm-btn:hover {
    background: var(--primary-hover);
}

/* Execute Dropdown Popover */
.execute-dropdown-popover {
    position: fixed;
    z-index: 1000;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: dropdownEnter 0.2s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.execute-dropdown-popover .dropdown-option .option-label {
    font-size: 13px;
}

.execute-dropdown-popover .dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 8px;
}

.execute-dropdown-popover .dropdown-agent-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.execute-dropdown-popover .dropdown-agent-row:hover {
    background: var(--bg-hover);
}

.execute-dropdown-popover .agent-row-label {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.execute-dropdown-popover .agent-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.execute-dropdown-popover .agent-action {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.execute-dropdown-popover .agent-action.start-from {
    color: var(--primary);
    background: var(--primary-light);
}

.execute-dropdown-popover .agent-action.start-from:hover {
    background: var(--primary);
    color: white;
}

.execute-dropdown-popover .agent-action.only-this {
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
}

.execute-dropdown-popover .agent-action.only-this:hover {
    background: #F59E0B;
    color: white;
}

/* ============================================
   SCENE CARD - OLD (COLLAPSED STATE)
   ============================================ */
.scene-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.scene-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-light);
    transition: background var(--transition-base);
}

.scene-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.scene-card:hover::before {
    background: var(--primary);
}

.scene-card.is-running::before {
    background: linear-gradient(90deg, var(--primary) 0%, var(--info) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    animation: runningGradient 2s linear infinite;
}

@keyframes runningGradient {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.scene-card.is-expanded {
    grid-column: span 1;
}

/* Card Header */
.scene-card-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.scene-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.scene-card-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.scene-card-info {
    flex: 1;
    min-width: 0;
}

.scene-card-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scene-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Agents Preview */
.scene-agents-preview {
    display: flex;
    align-items: center;
    gap: 2px;
}

.scene-agent-chip {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid var(--bg-secondary);
    margin-left: -6px;
    position: relative;
    transition: transform var(--transition-fast);
}

.scene-agent-chip:first-child {
    margin-left: 0;
}

.scene-agent-chip:hover {
    transform: scale(1.15);
    z-index: 10;
}

.scene-agents-count {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: 6px;
    font-weight: 500;
}

/* Schedule Badge */
.scene-schedule-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.scene-schedule-badge.manual {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.scene-schedule-badge.scheduled {
    background: var(--primary-light);
    color: var(--primary);
}

/* Card Body - Status */
.scene-card-body {
    padding: 0 20px 16px;
}

.scene-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.scene-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.scene-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scene-status-dot.idle {
    background: var(--border-medium);
}

.scene-status-dot.running {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: pulse-status 1.5s ease-in-out infinite;
}

.scene-status-dot.completed {
    background: var(--success);
}

.scene-status-dot.failed {
    background: var(--danger);
}

.scene-status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.scene-status-subtext {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Progress in status */
.scene-progress-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.scene-progress-mini-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
}

.scene-progress-mini-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Card Footer - Actions */
.scene-card-footer {
    padding: 12px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scene-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.scene-btn-execute {
    background: var(--primary);
    color: white;
}

.scene-btn-execute:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.scene-btn-execute:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scene-btn-stop {
    background: var(--danger);
    color: white;
}

.scene-btn-stop:hover {
    background: #DC2626;
}

.scene-btn-expand {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.scene-btn-expand:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.scene-btn-icon {
    font-size: 14px;
}

/* ============================================
   SCENE CARD - EXPANDED STATE
   ============================================ */
.scene-card-expanded {
    border-top: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    animation: expandIn 0.3s ease;
}

@keyframes expandIn {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 600px;
    }
}

.scene-card-expanded-inner {
    padding: 20px;
}

/* Description */
.scene-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

/* Agent Flow */
.scene-agent-flow {
    margin-bottom: 20px;
}

.scene-flow-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.scene-flow-diagram {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.scene-flow-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.scene-flow-node:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.scene-flow-node-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.scene-flow-node-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.scene-flow-arrow {
    color: var(--text-tertiary);
    font-size: 16px;
    flex-shrink: 0;
}

/* Config Grid */
.scene-config-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.scene-config-item {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.scene-config-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.scene-config-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Execution Stats */
.scene-exec-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.scene-exec-stat {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: var(--radius-xs);
}

.scene-exec-stat-value {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.scene-exec-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.scene-exec-stat.completed { background: var(--success-bg); }
.scene-exec-stat.completed .scene-exec-stat-value { color: var(--success); }

.scene-exec-stat.running { background: var(--primary-light); }
.scene-exec-stat.running .scene-exec-stat-value { color: var(--primary); }

.scene-exec-stat.pending { background: var(--bg-tertiary); }

.scene-exec-stat.failed { background: var(--danger-bg); }
.scene-exec-stat.failed .scene-exec-stat-value { color: var(--danger); }

/* Recent Executions */
.scene-recent-list {
    margin-bottom: 16px;
}

.scene-recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 12px;
}

.scene-recent-item:last-child {
    margin-bottom: 0;
}

.scene-recent-time {
    color: var(--text-tertiary);
    min-width: 110px;
    font-family: var(--font-mono);
    font-size: 11px;
}

.scene-recent-agent {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-weight: 500;
}

.scene-recent-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scene-recent-status.completed { color: var(--success); }
.scene-recent-status.running { color: var(--primary); }
.scene-recent-status.failed { color: var(--danger); }

/* Schedule Configuration */
.scene-schedule-config {
    margin-bottom: 20px;
}

.scene-schedule-form {
    display: flex;
    gap: 16px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.scene-schedule-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.scene-schedule-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scene-schedule-field select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scene-schedule-field input[type="time"],
.scene-schedule-field input[type="date"] {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.scene-schedule-field select:hover {
    border-color: var(--border-medium);
}

.scene-schedule-field select:focus,
.scene-schedule-field input[type="time"]:focus,
.scene-schedule-field input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.schedule-enable {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    min-height: 36px;
}

.scene-schedule-weekdays {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.scene-schedule-weekdays > label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.scene-schedule-weekday-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.scene-schedule-weekday-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
}

.scene-schedule-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Date Selector */
.scene-date-selector {
    margin-bottom: 16px;
}

.scene-date-btns {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.scene-date-btns button {
    padding: 6px 14px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scene-date-btns button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.scene-date-btns button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.scene-date-custom {
    margin-top: 10px;
}

.scene-date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.scene-date-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Preview */
.scene-preview {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.scene-preview-loading {
    color: var(--text-tertiary);
    font-size: 13px;
}

.scene-preview-agents {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.scene-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 13px;
}

.scene-preview-name {
    color: var(--text-secondary);
}

.scene-preview-count {
    font-weight: 600;
    color: var(--primary-color);
}

.scene-preview-count.zero {
    color: var(--text-tertiary);
}

.scene-preview-count.error {
    color: var(--error-color, #EF4444);
    font-weight: normal;
    font-size: 12px;
}

/* Expanded Actions */
.scene-expanded-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.scene-expanded-actions .scene-btn {
    flex: none;
    padding: 10px 20px;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.scene-center-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
}

.scene-center-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.scene-center-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
}

.scene-center-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.scene-center-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.scene-center-empty-desc {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .scene-center {
        padding: 16px;
    }

    .scene-center-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .scene-cards-grid {
        grid-template-columns: 1fr;
    }

    .scene-cards-grid-v2 {
        grid-template-columns: 1fr;
        max-width: 360px;
    }

    .scene-card-v2 {
        min-height: auto;
    }

    .scene-config-grid {
        grid-template-columns: 1fr;
    }

    .scene-exec-stats {
        flex-wrap: wrap;
    }

    .scene-exec-stat {
        flex: 1 1 calc(50% - 4px);
    }
}

/* ============================================
   SCENE EDIT DIALOG
   ============================================ */
.scene-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scene-edit-dialog {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.scene-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.scene-edit-header h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.scene-edit-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scene-edit-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.scene-edit-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.scene-edit-section {
    margin-bottom: 24px;
}

.scene-edit-section:last-child {
    margin-bottom: 0;
}

.scene-edit-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scene-edit-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.scene-edit-field {
    margin-bottom: 16px;
}

.scene-edit-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.scene-edit-field input,
.scene-edit-field select,
.scene-edit-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.scene-edit-field input:focus,
.scene-edit-field select:focus,
.scene-edit-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.scene-edit-field textarea {
    min-height: 80px;
    resize: vertical;
}

.scene-edit-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.scene-edit-btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scene-edit-btn-cancel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.scene-edit-btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.scene-edit-btn-save {
    background: var(--primary);
    border: none;
    color: white;
}

.scene-edit-btn-save:hover:not(:disabled) {
    background: var(--primary-hover);
}

.scene-edit-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   FLOW EDITOR (Scene Orchestration)
   ============================================ */
.flow-editor {
    display: flex;
    height: 500px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
}

.flow-editor-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.flow-editor-sidebar .sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.flow-editor-sidebar .sidebar-header h4 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.flow-editor-sidebar .sidebar-hint {
    font-size: 11px;
    color: var(--text-tertiary);
}

.agent-palette {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: grab;
    transition: all 0.15s ease;
}

.palette-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.palette-item:active {
    cursor: grabbing;
}

.palette-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.palette-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.palette-item-info {
    flex: 1;
    min-width: 0;
}

.palette-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    /* 允许两行显示 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.palette-item-type {
    font-size: 11px;
    color: var(--text-tertiary);
}

.palette-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Flow Editor Main */
.flow-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.zoom-level {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: center;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 4px;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px),
        linear-gradient(var(--border-light) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: var(--bg-primary);
}

.canvas-container.drag-over {
    background-color: var(--primary-light);
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform-origin: 0 0;
}

.connections-layer .connection-group {
    pointer-events: auto;
    cursor: pointer;
}

.connection-path-bg {
    fill: none;
    stroke: transparent;
    stroke-width: 20px;
}

.connection-path {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2px;
    stroke-linecap: round;
    transition: stroke 0.15s ease;
}

.connection-group:hover .connection-path {
    stroke: var(--danger);
    stroke-width: 3px;
}

.connection-arrow {
    fill: var(--primary);
    transition: fill 0.15s ease;
}

.connection-group:hover .connection-arrow {
    fill: var(--danger);
}

.temp-connection {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2px;
    stroke-dasharray: 8, 4;
    opacity: 0.6;
}

.nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    pointer-events: none;  /* 允许点击穿透到下面的连线层 */
}

.nodes-layer .flow-node {
    pointer-events: auto;  /* 节点本身可点击 */
}

/* Canvas Placeholder */
.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.canvas-placeholder .placeholder-icon {
    font-size: 48px;
    opacity: 0.4;
}

.canvas-placeholder .placeholder-text {
    font-size: 15px;
    font-weight: 500;
}

.canvas-placeholder .placeholder-hint {
    font-size: 12px;
    opacity: 0.7;
}

/* Flow Node */
.flow-node {
    position: absolute;
    width: 160px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    cursor: move;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    user-select: none;
}

.flow-node:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.flow-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

.flow-node.disabled {
    opacity: 0.5;
}

.flow-node.connection-target {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.flow-node.node-highlight {
    animation: nodeHighlight 1s ease;
}

@keyframes nodeHighlight {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.05); }
    50% { transform: scale(1); }
    75% { transform: scale(1.05); }
}

.node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    color: white;
}

.node-icon {
    font-size: 18px;
}

.node-order {
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
}

.node-body {
    padding: 10px 12px;
}

.node-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.node-type {
    font-size: 11px;
    color: var(--text-tertiary);
}

.node-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.flow-node:hover .node-delete {
    opacity: 1;
}

.node-delete:hover {
    transform: scale(1.1);
}

/* Node Connectors */
.node-connector {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: crosshair;
    transition: transform 0.15s ease, background 0.15s ease;
    z-index: 10;
}

.node-connector:hover {
    transform: scale(1.3);
    background: var(--primary);
}

.node-connector-in {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.node-connector-in:hover {
    transform: translateY(-50%) scale(1.3);
}

.node-connector-out {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.node-connector-out:hover {
    transform: translateY(-50%) scale(1.3);
}

/* ============================================
   SCENE CARD ACTIONS (Edit/Delete)
   ============================================ */
.scene-card-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.scene-card-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scene-card-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.scene-card-action.action-delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================
   HEADER NEW SCENE BUTTON
   ============================================ */
.scene-center-actions {
    display: flex;
    gap: 12px;
}

.btn-new-scene {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-new-scene:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ============================================
   EXECUTION ANIMATIONS
   Phase-driven card animations for scene lifecycle
   ============================================ */

/* --- 1. Startup Transition (idle → running) --- */

.scene-card-v2.is-starting {
    animation: cardActivate 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardActivate {
    0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);       border-color: var(--border-light); }
    40%  { box-shadow: 0 0 20px 4px rgba(59, 130, 246, 0.3); border-color: rgba(59, 130, 246, 0.5); }
    100% { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);   border-color: rgba(59, 130, 246, 0.2); }
}

.scene-card-v2.is-starting .scene-card-accent {
    animation: accentExpand 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes accentExpand {
    0%   { height: 4px; }
    60%  { height: 7px; }
    100% { height: 6px; }
}

/* Cross-fade transition between idle ↔ running content */
.exec-crossfade-enter-active {
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.exec-crossfade-leave-active {
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.exec-crossfade-enter-from {
    opacity: 0;
    transform: translateY(8px);
}
.exec-crossfade-leave-to {
    opacity: 0;
    transform: translateY(-6px);
}

/* --- 2. Running Ambient --- */

.scene-card-v2.is-running {
    animation: cardBreathe 3s ease-in-out infinite;
    border-color: rgba(59, 130, 246, 0.18);
}

@keyframes cardBreathe {
    0%, 100% { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.06); }
    50%      { box-shadow: 0 6px 24px rgba(59, 130, 246, 0.16); }
}

/* Enhanced tri-color accent flow (replaces base accentFlow when running) */
.scene-card-v2.is-running .scene-card-accent {
    height: 6px;
    background: linear-gradient(90deg, #3B82F6, #06B6D4, #8B5CF6, #3B82F6) !important;
    background-size: 300% 100% !important;
    animation: accentFlowEnhanced 3s linear infinite !important;
}

@keyframes accentFlowEnhanced {
    0%   { background-position: 300% 0; }
    100% { background-position: 0% 0; }
}

/* Bottom energy line */
.scene-card-energy-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), #06B6D4, transparent);
    background-size: 200% 100%;
    animation: edgeFlow 2s linear infinite;
    border-radius: 0 0 14px 14px;
    z-index: 1;
    pointer-events: none;
}

@keyframes edgeFlow {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- 3. Agent Step Animations --- */

/* Smooth row transitions for all state changes */
.agent-list-row {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Current agent: left indicator bar + order pulse ring */
.agent-list-row.is-current {
    border-left: 3px solid var(--primary);
    padding-left: 9px;
}

.agent-list-row.is-current .agent-order {
    animation: orderPulse 2s ease-in-out infinite;
}

@keyframes orderPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.35); }
    50%      { box-shadow: 0 0 0 5px rgba(59, 130, 246, 0); }
}

/* Done agent: check bounce-in + strikethrough name */
.agent-list-row.is-done .agent-list-name {
    text-decoration: line-through;
    text-decoration-color: var(--text-tertiary);
}

.agent-list-row.is-done .status-tag.done {
    animation: checkAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkAppear {
    0%   { opacity: 0; transform: scale(0) rotate(-45deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Next agent: dashed border blink */
.agent-list-row.is-next {
    animation: marchingAnts 1s linear infinite;
}

@keyframes marchingAnts {
    0%   { border-color: var(--warning); }
    50%  { border-color: rgba(245, 158, 11, 0.25); }
    100% { border-color: var(--warning); }
}

/* Skipped agent: diagonal stripe pattern */
.agent-list-row.is-skipped {
    background: repeating-linear-gradient(
        -45deg,
        var(--bg-tertiary),
        var(--bg-tertiary) 4px,
        rgba(0, 0, 0, 0.03) 4px,
        rgba(0, 0, 0, 0.03) 8px
    );
    opacity: 0.45;
}

/* --- 4. Progress Smoothing --- */

.progress-value {
    font-variant-numeric: tabular-nums;
}

.progress-bar-fill {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item {
    font-variant-numeric: tabular-nums;
}

/* --- 5. Completion Flash (running → done) --- */

.scene-card-v2.is-completing {
    animation: completionFlash 1.5s ease-out forwards;
}

@keyframes completionFlash {
    0%   { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); }
    30%  { box-shadow: 0 0 22px 5px rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.45); }
    100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); border-color: var(--border-light); }
}

.scene-card-v2.is-completing .scene-card-accent {
    animation: accentSuccess 1.5s ease-out forwards !important;
    background-size: 100% 100% !important;
}

@keyframes accentSuccess {
    0%   { background: linear-gradient(90deg, #3B82F6, #06B6D4, #8B5CF6) !important; }
    40%  { background: linear-gradient(90deg, #10B981, #34D399, #10B981) !important; }
    100% { background: linear-gradient(90deg, #10B981, #34D399, #10B981) !important; }
}

/* Completion ripple */
.scene-card-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    transform: translate(-50%, -50%);
    animation: completionRipple 1s ease-out forwards;
    pointer-events: none;
    z-index: 0;
}

@keyframes completionRipple {
    0%   { width: 0;     height: 0;     opacity: 0.4; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

/* --- 6. Error / Stop Flash --- */

.scene-card-v2.is-error {
    animation: errorFlash 0.8s ease-out;
}

@keyframes errorFlash {
    0%   { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); }
    20%  { box-shadow: 0 0 16px 3px rgba(239, 68, 68, 0.3); border-color: rgba(239, 68, 68, 0.5); }
    40%  { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);        border-color: rgba(239, 68, 68, 0.12); }
    60%  { box-shadow: 0 0 14px 2px rgba(239, 68, 68, 0.2);  border-color: rgba(239, 68, 68, 0.4); }
    100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);       border-color: var(--border-light); }
}

.scene-card-v2.is-error .scene-card-accent {
    background: linear-gradient(90deg, #EF4444, #F87171, #EF4444) !important;
    animation: none !important;
}

/* --- 7. Accessibility: Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
    .scene-card-v2,
    .scene-card-v2.is-starting,
    .scene-card-v2.is-running,
    .scene-card-v2.is-completing,
    .scene-card-v2.is-error,
    .scene-card-v2 .scene-card-accent,
    .scene-card-energy-line,
    .scene-card-ripple,
    .agent-list-row,
    .agent-list-row.is-current .agent-order,
    .agent-list-row.is-current .agent-list-icon,
    .agent-list-row.is-next,
    .agent-list-row.is-done .status-tag.done,
    .progress-bar-fill,
    .progress-bar-fill::after {
        animation: none !important;
        transition: none !important;
    }

    /* Keep static color indicators */
    .scene-card-v2.is-running {
        border-color: rgba(59, 130, 246, 0.25);
    }
    .scene-card-v2.is-completing {
        border-color: rgba(16, 185, 129, 0.25);
    }
    .scene-card-v2.is-error {
        border-color: rgba(239, 68, 68, 0.25);
    }

    .scene-card-energy-line,
    .scene-card-ripple {
        display: none;
    }

    .exec-crossfade-enter-active,
    .exec-crossfade-leave-active {
        transition: none !important;
    }
}
