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

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

.scene-center.ops-page.active {
    z-index: 1200;
}

.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;
    gap: 12px;
    padding: 16px 16px 14px;
}

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

.scene-card-copy {
    min-width: 0;
}

.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;
    flex-wrap: wrap;
    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;
    flex-wrap: wrap;
    column-gap: 6px;
    row-gap: 2px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-tertiary);
}

.scene-last-run-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.scene-meta-separator {
    color: var(--border-medium);
}

.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.hourly,
.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;
    position: static;
    z-index: 3;
    order: 1;
}

.scene-card-action-stack {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 5px;
    flex-shrink: 0;
    position: static;
}

.scene-primary-actions {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    order: 2;
}

.scene-execute-dropdown-trigger {
    width: 56px;
    height: 42px;
    padding: 0;
    border: 1.5px solid #3f7cff;
    border-radius: 14px;
    background: color-mix(in srgb, #3f7cff 6%, #f8fbff 94%);
    color: #2f6ff5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: none;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.scene-execute-dropdown-trigger::before {
    content: none;
}

.scene-execute-dropdown-trigger svg {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    filter: none;
    transition: transform 0.18s ease;
}

.scene-execute-dropdown-trigger:hover:not(:disabled) {
    background: color-mix(in srgb, #3f7cff 11%, #f8fbff 89%);
    border-color: #2f6ff5;
    color: #255ee8;
    transform: translateY(-1px);
}

.scene-execute-dropdown-trigger:hover:not(:disabled) svg {
    transform: translateX(2px);
}

.scene-execute-dropdown-trigger:active:not(:disabled) {
    transform: translateY(0);
    background: color-mix(in srgb, #3f7cff 16%, #f8fbff 84%);
}

.scene-execute-dropdown-trigger:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.55);
    outline-offset: 2px;
}

.scene-execute-dropdown-trigger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.scene-mini-stop-btn {
    width: 56px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    background: color-mix(in srgb, #ff6565 5%, #f8fbff 95%);
    border: 1.5px solid #ff6565;
    color: #ff6b73;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.scene-mini-stop-btn:hover {
    background: color-mix(in srgb, #ff6565 10%, #f8fbff 90%);
    border-color: #ff4e58;
    color: #ff4e58;
}

.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;
}

.scene-center .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;
}

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

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

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

.scene-center .agent-list-row.is-queued {
    border-color: var(--warning);
}

.scene-center .agent-list-row.is-waiting {
    border-color: var(--border-light);
    opacity: 0.82;
}

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

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

.agent-order {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ops-card-soft, var(--bg-secondary));
    border: 1px solid var(--ops-line-soft, var(--border-light));
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    color: var(--ops-muted, var(--text-tertiary));
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.scene-center .agent-list-row.is-current .agent-order {
    background: var(--ops-blue, var(--primary));
    border-color: var(--ops-blue, var(--primary));
    color: white;
}

.scene-center .agent-list-row.is-done .agent-order {
    background: color-mix(in srgb, var(--ops-ok, #10b981) 10%, var(--ops-card-soft, var(--bg-secondary)));
    border-color: color-mix(in srgb, var(--ops-ok, #10b981) 48%, var(--ops-line-soft, var(--border-light)));
    color: var(--ops-ok, #10b981);
}

.scene-center .agent-list-row.is-skipped .agent-order {
    background: var(--ops-card-soft, var(--bg-secondary));
    color: var(--ops-muted, var(--text-tertiary));
}

.agent-list-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

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

.agent-effective-filter {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
}

.agent-list-status {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-width: max-content;
}

.status-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1.2;
    white-space: nowrap;
    word-break: keep-all;
}

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

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

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

.status-tag.waiting {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.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;
}

.scene-center .agent-list-row.has-report-preview {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    row-gap: 6px;
    background: color-mix(in srgb, var(--ops-blue, var(--primary)) 5%, var(--ops-panel, var(--bg-secondary)));
    border-color: color-mix(in srgb, var(--ops-blue, var(--primary)) 24%, var(--ops-line-soft, var(--border-light)));
}

.scene-center .agent-list-row.has-report-preview .agent-order {
    grid-column: 1;
    grid-row: 1;
}

.scene-center .agent-list-row.has-report-preview .agent-list-main {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.scene-center .agent-list-row.has-report-preview .agent-list-name {
    align-self: center;
}

.scene-center .agent-list-row.has-report-preview .agent-preview-count.report-preview {
    grid-column: 2;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.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;
}

.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;
}

.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);
}

/* 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;
    flex-wrap: wrap;
    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="number"],
.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="number"]: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-modal {
        align-items: flex-end;
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .scene-edit-dialog {
        width: 100%;
        max-width: none;
        height: min(100dvh, 100vh);
        max-height: min(100dvh, 100vh);
        border-radius: 20px 20px 0 0;
    }

    .scene-edit-header {
        padding: 16px;
    }

    .scene-edit-body {
        padding: 16px;
        overscroll-behavior: contain;
    }

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

    .scene-edit-section-title,
    .scene-edit-section-title--trigger {
        flex-wrap: wrap;
        gap: 10px;
    }

    .scene-edit-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .scene-schedule-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }

    .scene-schedule-field {
        width: 100%;
        min-width: 0 !important;
    }

    .scene-schedule-weekday-list {
        gap: 10px;
    }

    .scene-trigger-add-btn {
        width: 100%;
        text-align: center;
    }

    .scene-trigger-block {
        padding: 12px;
    }

    .scene-trigger-row {
        align-items: stretch;
        gap: 10px;
    }

    .scene-trigger-enable,
    .scene-trigger-select,
    .scene-trigger-interval-label {
        width: 100%;
    }

    .scene-trigger-select {
        min-width: 0;
    }

    .scene-trigger-interval-label {
        justify-content: space-between;
    }

    .scene-trigger-conditions {
        padding-left: 0;
    }

    .scene-trigger-cond-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .scene-trigger-cond-field,
    .scene-trigger-cond-op {
        width: 100%;
        min-width: 0 !important;
    }

    #sceneFlowEditorContainer {
        min-height: 360px !important;
    }

    .flow-editor {
        flex-direction: column;
        height: min(66vh, 560px);
        min-height: 480px;
    }

    .flow-editor-sidebar {
        width: 100%;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }

    .agent-palette {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-content: start;
    }

    .palette-item {
        margin-bottom: 0;
        padding: 10px 12px;
    }

    .canvas-toolbar {
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    .scene-edit-footer {
        gap: 10px;
        padding: 14px 16px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .scene-edit-btn {
        flex: 1 1 0;
        min-height: 44px;
        padding: 12px 16px;
    }
}

/* ============================================
   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-agent-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.palette-agent-group + .palette-agent-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.palette-agent-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
}

.palette-agent-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 700;
}

.palette-agent-group-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.palette-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px 10px;
    align-items: start;
    padding: 9px 10px;
    background: #fff;
    border: 1px solid rgba(216, 224, 236, 0.9);
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: grab;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.palette-agent-group-list .palette-item {
    margin-bottom: 0;
}

.palette-item:hover {
    border-color: rgba(37, 99, 235, 0.24);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

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

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

.palette-item-drag-handle {
    width: 12px;
    height: 24px;
    margin: 1px auto 0;
    border-radius: 999px;
    opacity: 0.55;
    background-image: radial-gradient(circle, rgba(100, 116, 139, 0.72) 1.2px, transparent 1.3px);
    background-size: 6px 6px;
    background-position: 0 0;
    transition: opacity 0.18s ease, background-image 0.18s ease;
}

.palette-item:hover .palette-item-drag-handle {
    opacity: 1;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--primary) 76%, #64748b 24%) 1.2px, transparent 1.3px);
}

.palette-item-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.palette-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.palette-item-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.45;
    /* 允许两行显示 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.palette-item-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 22px;
    padding: 2px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.palette-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.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: 220px;
    min-height: 72px;
    background: #fff;
    border: 1px solid rgba(59, 75, 105, 0.38);
    border-radius: 12px;
    box-shadow: 0 12px 26px rgba(21, 34, 56, 0.10);
    cursor: move;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
    user-select: none;
    overflow: visible;
}

.flow-node:hover {
    box-shadow: 0 16px 32px rgba(21, 34, 56, 0.14);
    border-color: rgba(63, 124, 255, 0.52);
}

.flow-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent), 0 16px 32px rgba(21, 34, 56, 0.14);
}

.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-body {
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr);
    gap: 11px;
    align-items: center;
    min-height: 72px;
    padding: 12px 14px;
}

.node-accent {
    width: 5px;
    height: 44px;
    border-radius: 999px;
    background: var(--node-accent, var(--primary));
}

.node-main {
    min-width: 0;
}

.node-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

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

.node-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 28px;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--node-accent, var(--primary)) 12%, #fff 88%);
    color: var(--node-accent, var(--primary));
    font-size: 12px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.node-type {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-tertiary);
    font-weight: 700;
}

.node-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #fff;
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 42%, #fff 58%);
    border-radius: 50%;
    font-size: 16px;
    font-weight: 850;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    box-shadow: 0 8px 18px rgba(21, 34, 56, 0.12);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

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

.node-delete:hover {
    transform: scale(1.1);
    background: color-mix(in srgb, var(--danger) 7%, #fff 93%);
}

/* Node Connectors */
.node-connector {
    position: absolute;
    top: 50%;
    width: 28px;
    height: 34px;
    right: auto;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: crosshair;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transform: translate(-50%, -50%);
}

.node-connector::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 11%, transparent);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.node-connector:hover {
    transform: translate(-50%, -50%);
}

.node-connector:hover::before {
    transform: scale(1.18);
    background: var(--primary);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 14%, transparent);
}

.node-connector-in {
    left: 0;
}

.node-connector-in:hover {
    transform: translate(-50%, -50%);
}

.node-connector-out {
    left: 100%;
}

.node-connector-out:hover {
    transform: translate(-50%, -50%);
}

/* ============================================
   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 */
.scene-center .agent-list-row {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.scene-center .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 */
.scene-center .agent-list-row.is-done .agent-list-name {
    text-decoration: line-through;
    text-decoration-color: var(--text-tertiary);
}

.scene-center .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 */
.scene-center .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,
    .scene-center .agent-list-row,
    .scene-center .agent-list-row.is-current .agent-order,
    .scene-center .agent-list-row.is-next,
    .scene-center .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;
    }
}

@media (max-width: 768px) {
    .scene-edit-modal {
        align-items: flex-end;
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .scene-edit-dialog {
        width: 100%;
        max-width: none;
        height: min(100dvh, 100vh);
        max-height: min(100dvh, 100vh);
        border-radius: 20px 20px 0 0;
    }

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

    .scene-edit-footer {
        padding: 14px 16px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .flow-editor {
        flex-direction: column;
        height: min(66vh, 560px);
        min-height: 480px;
    }

    .flow-editor-sidebar {
        width: 100%;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
}

/* ============================================
   OPS MONITOR STANDARD ADOPTION
   Shared style target: task-manager execution monitor
   ============================================ */
.scene-center {
    padding: 22px 28px 28px;
    background: var(--ops-bg);
    color: var(--ops-text);
}

.scene-center-header {
    align-items: stretch;
    gap: 0;
    margin-bottom: 18px;
    padding: 0;
    border: 1px solid var(--ops-line);
    border-radius: 14px;
    background: var(--ops-panel);
    overflow: hidden;
    box-shadow: var(--ops-shadow-soft);
}

.scene-center-title {
    min-height: 64px;
    padding: 16px 20px;
    gap: 10px;
    background: var(--ops-panel-2);
    border-right: 1px solid var(--ops-line);
}

.scene-center-title::before {
    content: '';
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: var(--ops-text);
    flex: 0 0 auto;
}

.scene-center-title-icon {
    display: none !important;
}

.scene-center-title h1,
.scene-center-title .ops-panel-title {
    font-family: "SF Pro Display", "PingFang SC", var(--font-display);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--ops-text);
}

.scene-center-actions {
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--ops-panel);
}

.scene-stat {
    min-height: 40px;
    gap: 7px;
    padding: 7px 12px;
    background: var(--ops-row);
    border-color: var(--ops-line-soft);
    border-radius: 8px;
}

.scene-stat-value {
    color: var(--ops-text);
    font-family: "SF Pro Display", "PingFang SC", var(--font-display);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

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

.btn-new-scene {
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid var(--ops-btn-border);
    border-radius: 8px;
    background: var(--ops-btn);
    color: var(--ops-btn-text);
    box-shadow: none;
    font-family: "SF Pro Text", "PingFang SC", var(--font-body);
    font-size: 13px;
    font-weight: 600;
}

.btn-new-scene:hover {
    background: color-mix(in srgb, var(--ops-blue) 10%, var(--ops-btn));
    border-color: color-mix(in srgb, var(--ops-blue) 48%, var(--ops-btn-border));
    color: var(--ops-blue);
    box-shadow: none;
    transform: translateY(-1px);
}

.scene-cards-grid-v2 {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
    gap: 18px;
    justify-content: stretch;
}

.scene-card-v2 {
    min-height: 0;
    background: var(--ops-panel);
    border: 1px solid color-mix(in srgb, var(--ops-line) 88%, var(--ops-line-strong) 12%);
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03), 0 10px 24px rgba(15, 23, 42, 0.05);
    color: var(--ops-text);
}

.scene-card-v2:hover {
    border-color: color-mix(in srgb, var(--ops-line-strong) 34%, var(--ops-line));
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 14px 30px rgba(15, 23, 42, 0.075);
    transform: none;
}

.scene-card-v2.is-drop-target {
    border-color: var(--ops-blue);
    background: color-mix(in srgb, var(--ops-blue) 7%, var(--ops-row-deep));
    transform: none;
}

.scene-card-accent {
    height: 4px;
    background: linear-gradient(90deg, var(--ops-blue), var(--ops-blue-2)) !important;
}

.scene-card-v2.is-running {
    border-color: color-mix(in srgb, var(--ops-blue) 26%, var(--ops-line));
    animation: none;
    box-shadow: none;
}

.scene-card-v2.is-running .scene-card-accent {
    height: 5px;
    background: linear-gradient(90deg, var(--ops-blue), var(--ops-blue-2), var(--ops-blue)) !important;
}

.scene-card-energy-line {
    background: linear-gradient(90deg, transparent, var(--ops-blue), var(--ops-blue-2), transparent);
}

.scene-card-top {
    min-height: 76px;
    padding: 14px 16px 12px;
    background: linear-gradient(180deg, var(--ops-row) 0%, color-mix(in srgb, var(--ops-row) 62%, var(--ops-panel) 38%) 100%);
    border-bottom: 1px solid var(--ops-line);
}

.scene-card-title-row {
    gap: 7px;
}

.scene-card-title {
    font-family: "SF Pro Display", "PingFang SC", var(--font-display);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--ops-text);
}

.scene-card-schedule,
.scene-card-trigger-info {
    color: var(--ops-muted);
    font-size: 12px;
}

.scene-last-run-inline {
    color: var(--ops-muted);
}

.scene-meta-separator {
    color: color-mix(in srgb, var(--ops-muted) 45%, transparent);
}

.scene-plan-badge,
.scene-trigger-badge {
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.2;
}

.scene-card-action-stack {
    gap: 5px;
    min-width: 172px;
}

.scene-primary-actions {
    min-height: 28px;
}

.scene-execute-dropdown-trigger,
.scene-mini-stop-btn {
    width: 34px;
    height: 28px;
    border-radius: 8px;
    box-shadow: none;
}

.scene-execute-dropdown-trigger {
    border: 1px solid var(--ops-blue);
    background: color-mix(in srgb, var(--ops-blue) 8%, var(--ops-row) 92%);
    color: var(--ops-blue);
}

.scene-execute-dropdown-trigger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--ops-blue) 13%, var(--ops-row));
    border-color: var(--ops-blue);
    color: var(--ops-blue);
    transform: none;
}

.scene-execute-dropdown-trigger:focus-visible {
    outline: 3px solid var(--ops-focus-ring);
    outline-offset: 2px;
}

.scene-mini-stop-btn {
    border: 1px solid var(--ops-danger);
    background: transparent;
    color: var(--ops-danger-text);
}

.scene-mini-stop-btn:hover {
    background: color-mix(in srgb, var(--ops-danger) 10%, transparent);
    border-color: var(--ops-danger);
    color: var(--ops-danger-text);
}

.scene-card-tools {
    position: static;
    gap: 5px;
    opacity: 1;
}

.scene-tool-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--ops-btn-border);
    border-radius: 8px;
    background: var(--ops-btn);
    color: var(--ops-btn-text);
}

.scene-tool-btn:hover {
    background: color-mix(in srgb, var(--ops-blue) 9%, var(--ops-btn));
    border-color: color-mix(in srgb, var(--ops-blue) 44%, var(--ops-btn-border));
    color: var(--ops-blue);
}

.scene-tool-btn.danger:hover {
    background: color-mix(in srgb, var(--ops-danger) 9%, transparent);
    border-color: var(--ops-danger);
    color: var(--ops-danger-text);
}

.scene-date-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 28px;
    min-width: 52px;
    max-width: 76px;
    padding: 0 8px;
    border: 1px solid var(--ops-btn-border);
    border-radius: 8px;
    background: var(--ops-btn);
    color: var(--ops-btn-text);
    font-family: "SF Pro Text", "PingFang SC", var(--font-body);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.scene-date-tool-btn svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.scene-date-tool-btn span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scene-date-tool-btn:hover {
    background: color-mix(in srgb, var(--ops-blue) 9%, var(--ops-btn));
    border-color: color-mix(in srgb, var(--ops-blue) 44%, var(--ops-btn-border));
    color: var(--ops-blue);
}

.scene-date-tool-btn:focus-visible {
    outline: 3px solid var(--ops-focus-ring);
    outline-offset: 2px;
}

.scene-agents-list-v2 {
    padding: 12px 14px 14px;
    background: color-mix(in srgb, var(--ops-row-deep) 45%, var(--ops-panel) 55%);
    flex: 0 1 auto;
}

.agents-list-header {
    min-height: 28px;
    margin-bottom: 10px;
    padding: 0 8px;
    border: 1px solid color-mix(in srgb, var(--ops-line-soft) 68%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--ops-row) 76%, var(--ops-panel) 24%);
}

.agents-list-title,
.agents-list-count {
    color: var(--ops-muted);
    font-family: "SF Pro Text", "PingFang SC", var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.agents-list-count {
    min-width: 26px;
    padding: 2px 7px;
    border: 1px solid var(--ops-line-soft);
    border-radius: 999px;
    background: var(--ops-panel);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.agents-list-items {
    gap: 8px;
}

.scene-center .agent-list-row {
    position: relative;
    min-height: 46px;
    padding: 9px 10px 9px 11px;
    background: var(--ops-panel);
    border: 1px solid color-mix(in srgb, var(--ops-line-soft) 84%, var(--ops-line-strong) 16%);
    border-left: 4px solid color-mix(in srgb, var(--ops-blue) 44%, var(--ops-line-soft));
    border-radius: 9px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03), 0 8px 18px rgba(15, 23, 42, 0.045);
    color: var(--ops-text);
}

.scene-center .agent-list-row:hover {
    background: color-mix(in srgb, var(--ops-blue) 4%, var(--ops-panel));
    border-color: color-mix(in srgb, var(--ops-blue) 32%, var(--ops-line-soft));
    border-left-color: var(--ops-blue);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 10px 22px rgba(15, 23, 42, 0.065);
}

.scene-center .agent-list-row.is-current {
    padding-left: 11px;
    background: color-mix(in srgb, var(--ops-blue) 10%, var(--ops-panel));
    border-color: color-mix(in srgb, var(--ops-blue) 52%, var(--ops-line-soft));
    border-left: 4px solid var(--ops-blue);
}

.scene-center .agent-list-row.is-next {
    background: color-mix(in srgb, var(--ops-warn, #f59e0b) 7%, var(--ops-panel));
    border-left-color: var(--ops-warn, #f59e0b);
}

.scene-center .agent-list-row.is-queued {
    background: color-mix(in srgb, var(--ops-warn, #f59e0b) 5%, var(--ops-panel));
    border-left-color: var(--ops-warn, #f59e0b);
}

.scene-center .agent-list-row.is-waiting {
    border-left-color: color-mix(in srgb, var(--ops-muted) 42%, var(--ops-line-soft));
}

.agent-order {
    background: color-mix(in srgb, var(--ops-row) 76%, var(--ops-panel) 24%);
    color: var(--ops-muted);
    border: 1px solid var(--ops-line-soft);
    width: 24px;
    height: 24px;
    font-weight: 800;
}

.agent-list-name {
    color: var(--ops-text);
    font-size: 13px;
    font-weight: 700;
}

.agent-effective-filter {
    color: var(--ops-muted);
}

.agent-preview-count {
    color: var(--ops-blue);
    background: color-mix(in srgb, var(--ops-blue) 8%, var(--ops-row));
    border: 1px solid color-mix(in srgb, var(--ops-blue) 18%, var(--ops-line-soft));
    border-radius: 7px;
}

.agents-expand-btn,
.date-selector-trigger,
.dropdown-confirm-btn {
    border-radius: 8px;
}

.agents-expand-btn {
    border-color: var(--ops-btn-border);
    background: var(--ops-btn);
    color: var(--ops-btn-text);
}

.agents-expand-btn:hover {
    border-color: color-mix(in srgb, var(--ops-blue) 44%, var(--ops-btn-border));
    background: color-mix(in srgb, var(--ops-blue) 8%, var(--ops-btn));
    color: var(--ops-blue);
}

.scene-execution-zone {
    padding: 0 16px 16px;
}

.execution-progress-area {
    border: 1px solid var(--ops-line-soft);
    border-radius: 8px;
    background: var(--ops-card-soft);
}

.execution-progress-area {
    padding: 10px;
}

.progress-label,
.progress-value,
.tailing-badge {
    color: var(--ops-blue);
}

.progress-bar-track {
    height: 7px;
    background: color-mix(in srgb, var(--ops-line) 70%, transparent);
    border-radius: 999px;
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--ops-blue), var(--ops-blue-2));
    border-radius: inherit;
}

.stat-item.done { color: var(--ops-ok); }
.stat-item.active { color: var(--ops-blue); }
.stat-item.wait { color: var(--ops-muted); }
.stat-item.fail { color: var(--ops-danger-text); }

.date-selector-trigger {
    background: var(--ops-panel);
    border-color: var(--ops-line-soft);
    color: var(--ops-text);
}

.date-selector-trigger:hover {
    border-color: color-mix(in srgb, var(--ops-blue) 44%, var(--ops-line-soft));
    background: var(--ops-row);
}

.date-dropdown-popover,
.execute-dropdown-popover {
    background: var(--ops-panel);
    border: 1px solid var(--ops-line);
    border-radius: 12px;
    box-shadow: var(--ops-shadow-panel);
}

.dropdown-header {
    background: var(--ops-panel-2);
    border-bottom-color: var(--ops-line);
    color: var(--ops-muted);
    text-transform: none;
    letter-spacing: 0;
}

.dropdown-section-label {
    color: var(--ops-muted);
    text-transform: none;
    letter-spacing: 0;
}

.dropdown-option:hover,
.execute-dropdown-popover .dropdown-agent-row:hover {
    background: var(--ops-row-deep);
}

.dropdown-option.active {
    background: color-mix(in srgb, var(--ops-blue) 10%, var(--ops-row));
}

.dropdown-option.active .option-label,
.option-count,
.preview-count {
    color: var(--ops-blue);
}

.execute-dropdown-popover .dropdown-divider,
.dropdown-section-label:not(:first-child),
.dropdown-custom-date,
.dropdown-preview,
.dropdown-footer {
    border-color: var(--ops-line);
}

.execute-dropdown-popover .agent-action.start-from {
    background: color-mix(in srgb, var(--ops-blue) 9%, var(--ops-row));
    color: var(--ops-blue);
    border: 1px solid color-mix(in srgb, var(--ops-blue) 22%, var(--ops-line-soft));
}

.execute-dropdown-popover .agent-action.start-from:hover {
    background: var(--ops-blue);
    color: #fff;
}

.execute-dropdown-popover .agent-action.only-this {
    background: var(--ops-btn);
    color: var(--ops-btn-text);
    border: 1px solid var(--ops-btn-border);
}

.execute-dropdown-popover .agent-action.only-this:hover {
    background: color-mix(in srgb, var(--ops-warn) 18%, var(--ops-btn));
    color: var(--ops-text);
}

.scene-center-loading,
.scene-center-empty {
    background: var(--ops-panel);
    border: 1px solid var(--ops-line);
    border-radius: 14px;
    color: var(--ops-muted);
    box-shadow: var(--ops-shadow-soft);
}

.scene-center-empty {
    border-style: dashed;
}

.scene-center-empty-icon {
    display: none;
}

.scene-center-empty-title {
    color: var(--ops-text);
}

.scene-edit-dialog {
    background: var(--ops-panel);
    border: 1px solid var(--ops-line);
    border-radius: 14px;
    box-shadow: var(--ops-shadow-panel);
}

.scene-edit-header,
.scene-edit-footer,
.canvas-toolbar,
.flow-editor-sidebar .sidebar-header {
    background: var(--ops-panel-2);
    border-color: var(--ops-line);
}

.scene-edit-body,
.flow-editor,
.canvas-container {
    background-color: var(--ops-bg);
}

.scene-edit-section-title,
.scene-edit-header h2,
.flow-editor-sidebar .sidebar-header h4 {
    color: var(--ops-text);
}

.scene-edit-field input,
.scene-edit-field select,
.scene-edit-field textarea,
.scene-schedule-field select,
.scene-schedule-field input[type="time"],
.scene-schedule-field input[type="number"],
.scene-schedule-field input[type="date"],
.scene-trigger-input,
.scene-trigger-select,
.dropdown-custom-date input {
    background: var(--ops-row);
    border-color: var(--ops-line-soft);
    color: var(--ops-text);
}

.scene-edit-field input:focus,
.scene-edit-field select:focus,
.scene-edit-field textarea:focus,
.scene-schedule-field select:focus,
.scene-schedule-field input[type="time"]:focus,
.scene-schedule-field input[type="number"]:focus,
.scene-schedule-field input[type="date"]:focus,
.scene-trigger-input:focus,
.scene-trigger-select:focus,
.dropdown-custom-date input:focus {
    border-color: var(--ops-blue);
    box-shadow: 0 0 0 3px var(--ops-focus-ring);
}

.scene-edit-btn-cancel,
.scene-edit-close,
.toolbar-btn {
    background: var(--ops-btn);
    border: 1px solid var(--ops-btn-border);
    color: var(--ops-btn-text);
}

.scene-edit-btn-cancel:hover,
.scene-edit-close:hover,
.toolbar-btn:hover {
    background: color-mix(in srgb, var(--ops-blue) 8%, var(--ops-btn));
    border-color: color-mix(in srgb, var(--ops-blue) 44%, var(--ops-btn-border));
    color: var(--ops-blue);
}

.scene-edit-btn-save,
.dropdown-confirm-btn {
    background: var(--ops-blue);
    color: #fff;
}

.scene-edit-btn-save:hover:not(:disabled),
.dropdown-confirm-btn:hover {
    background: #255ee8;
}

.scene-edit-modal {
    background:
        radial-gradient(circle at 20% 0%, rgba(47, 111, 245, 0.18), transparent 34%),
        rgba(10, 21, 37, 0.58);
    padding: 10px;
}

.scene-edit-dialog--flow-first {
    width: min(1680px, calc(100vw - 20px));
    height: min(960px, calc(100dvh - 20px));
    max-width: none;
    max-height: none;
    border-radius: 16px;
    overflow: hidden;
}

.scene-edit-dialog--flow-first .scene-edit-header {
    min-height: 54px;
    padding: 10px 16px;
}

.scene-edit-dialog--flow-first .scene-edit-header h2 {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0;
}

.scene-edit-dialog--flow-first .scene-edit-header p {
    margin: 4px 0 0;
    color: var(--ops-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 640px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scene-edit-body--flow-first {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 10px;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
}

.scene-flow-workbench,
.scene-edit-rail-card {
    border: 1px solid var(--ops-line);
    border-radius: 14px;
    background: var(--ops-panel);
    box-shadow: var(--ops-shadow-soft);
}

.scene-flow-workbench {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.scene-flow-workbench-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--ops-line);
    background: var(--ops-panel-2);
}

.scene-flow-workbench-title {
    min-width: 0;
}

.scene-flow-workbench-title span {
    display: block;
    color: var(--ops-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.scene-flow-workbench-title h3 {
    margin: 3px 0 0;
    color: var(--ops-text);
    font-size: 18px;
    font-weight: 850;
    letter-spacing: 0;
}

.scene-flow-mode-toggle {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 3px;
    border: 1px solid var(--ops-line);
    border-radius: 9px;
    background: var(--ops-row);
}

.scene-flow-mode-toggle button {
    min-width: 92px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ops-muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0;
    cursor: pointer;
}

.scene-flow-mode-toggle button.active {
    background: #FFFFFF;
    color: var(--ops-blue);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.scene-flow-workbench-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.scene-flow-workbench-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid var(--ops-line-soft);
    border-radius: 8px;
    background: var(--ops-row);
    color: var(--ops-muted);
    font-size: 11px;
    font-weight: 800;
}

.scene-flow-editor-host {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.scene-flow-editor-host .flow-editor {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
}

.scene-edit-dialog--flow-first .flow-editor-sidebar {
    width: 258px;
    background: var(--ops-panel);
}

.scene-edit-dialog--flow-first .flow-editor-sidebar .sidebar-header {
    padding: 12px 14px;
}

.scene-edit-dialog--flow-first .flow-editor-sidebar .sidebar-hint {
    display: none;
}

.scene-edit-dialog--flow-first .agent-palette {
    padding: 10px;
}

.scene-edit-dialog--flow-first .palette-agent-group {
    gap: 8px;
}

.scene-edit-dialog--flow-first .palette-agent-group + .palette-agent-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top-color: var(--ops-line);
}

.scene-edit-dialog--flow-first .palette-agent-group-title {
    color: var(--ops-muted);
    font-size: 11px;
    font-weight: 850;
}

.scene-edit-dialog--flow-first .palette-agent-group-count {
    min-height: 18px;
    min-width: 24px;
    background: var(--ops-row);
    border: 1px solid var(--ops-line-soft);
    color: var(--ops-muted);
}

.scene-edit-dialog--flow-first .palette-item {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px 10px;
    min-height: 64px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-color: var(--ops-line-soft);
    border-radius: 10px;
    background: #fff;
    box-shadow: none;
}

.scene-edit-dialog--flow-first .palette-item-drag-handle {
    background-image: radial-gradient(circle, color-mix(in srgb, var(--ops-muted) 82%, transparent) 1.2px, transparent 1.3px);
}

.scene-edit-dialog--flow-first .palette-item:hover .palette-item-drag-handle {
    background-image: radial-gradient(circle, color-mix(in srgb, var(--ops-blue) 76%, var(--ops-muted) 24%) 1.2px, transparent 1.3px);
}

.scene-edit-dialog--flow-first .palette-item-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--ops-text);
}

.scene-edit-dialog--flow-first .palette-item-status {
    min-height: 18px;
    padding: 0 7px;
    background: color-mix(in srgb, var(--ops-blue) 10%, transparent);
    color: var(--ops-blue);
    font-size: 10px;
    font-weight: 850;
}

.scene-edit-dialog--flow-first .palette-item-meta {
    font-size: 12px;
    color: var(--ops-muted);
}

.scene-edit-dialog--flow-first .canvas-toolbar {
    min-height: 42px;
    padding: 7px 10px;
}

.scene-edit-dialog--flow-first .canvas-container {
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ops-line-soft) 64%, transparent) 1px, transparent 1px),
        linear-gradient(color-mix(in srgb, var(--ops-line-soft) 64%, transparent) 1px, transparent 1px);
    background-color: color-mix(in srgb, var(--ops-bg) 86%, #fff 14%);
    background-size: 24px 24px;
}

.scene-edit-dialog--flow-first .flow-node {
    width: 220px;
    min-height: 72px;
    border: 1px solid var(--ops-line-strong);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(21, 34, 56, 0.10);
}

.scene-edit-dialog--flow-first .node-body {
    min-height: 72px;
    padding: 12px 14px;
}

.scene-edit-dialog--flow-first .node-accent {
    height: 44px;
}

.scene-edit-dialog--flow-first .node-order {
    background: color-mix(in srgb, var(--node-accent, var(--ops-blue)) 12%, #fff 88%);
    color: var(--node-accent, var(--ops-blue));
    font-size: 12px;
}

.scene-edit-dialog--flow-first .node-name {
    color: var(--ops-text);
    font-size: 13px;
    font-weight: 850;
}

.scene-edit-dialog--flow-first .node-type {
    margin-top: 5px;
    color: var(--ops-muted);
    font-size: 12px;
    font-weight: 700;
}

.scene-edit-rail {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.scene-edit-rail-card {
    padding: 12px;
}

.scene-edit-rail-title,
.scene-edit-accordion > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--ops-text);
    font-size: 13px;
    font-weight: 850;
    list-style: none;
}

.scene-edit-accordion > summary {
    cursor: pointer;
}

.scene-edit-accordion > summary::-webkit-details-marker {
    display: none;
}

.scene-edit-rail-title strong,
.scene-edit-accordion > summary strong {
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid var(--ops-line-soft);
    border-radius: 999px;
    background: var(--ops-row);
    color: var(--ops-muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.scene-edit-accordion[open] > summary {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ops-line);
    margin-bottom: 10px;
}

.scene-edit-dialog--flow-first .scene-edit-field {
    margin: 10px 0 0;
}

.scene-edit-dialog--flow-first .scene-edit-field label,
.scene-edit-dialog--flow-first .scene-schedule-field label {
    color: var(--ops-muted);
    font-size: 11px;
    font-weight: 850;
}

.scene-edit-dialog--flow-first .scene-edit-field input,
.scene-edit-dialog--flow-first .scene-edit-field select,
.scene-edit-dialog--flow-first .scene-edit-field textarea,
.scene-edit-dialog--flow-first .scene-schedule-field select,
.scene-edit-dialog--flow-first .scene-schedule-field input[type="time"],
.scene-edit-dialog--flow-first .scene-schedule-field input[type="number"],
.scene-edit-dialog--flow-first .scene-schedule-field input[type="date"],
.scene-edit-dialog--flow-first .scene-trigger-input,
.scene-edit-dialog--flow-first .scene-trigger-select {
    min-height: 34px;
    border-radius: 9px;
    font-size: 13px;
}

.scene-edit-dialog--flow-first .scene-edit-field textarea {
    min-height: 92px;
}

.scene-edit-compact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 10px;
}

.scene-edit-color-field input[type="color"] {
    height: 36px;
    padding: 4px;
}

.scene-edit-dialog--flow-first .scene-schedule-config {
    padding: 0;
    border: 0;
    background: transparent;
}

.scene-edit-dialog--flow-first .scene-schedule-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 0;
}

.scene-edit-dialog--flow-first .scene-schedule-field {
    min-width: 0 !important;
}

.scene-edit-dialog--flow-first .scene-schedule-field--switch,
.scene-edit-dialog--flow-first .scene-schedule-field--mode {
    grid-column: span 2;
}

.scene-edit-dialog--flow-first .schedule-enable {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--ops-line-soft);
    border-radius: 9px;
    background: var(--ops-row);
}

.scene-edit-dialog--flow-first .scene-schedule-weekdays {
    margin-top: 10px;
}

.scene-edit-dialog--flow-first .scene-schedule-weekday-list {
    gap: 6px;
}

.scene-edit-dialog--flow-first .scene-schedule-weekday-item {
    min-height: 28px;
    border-radius: 8px;
}

.scene-trigger-panel-head {
    margin-bottom: 10px;
}

.scene-edit-dialog--flow-first .scene-trigger-add-btn {
    width: 100%;
    min-height: 30px;
    border-radius: 8px;
}

.scene-edit-dialog--flow-first .scene-trigger-source-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--ops-line-soft);
    border-radius: 10px;
    background: #FFFFFF;
}

.scene-edit-dialog--flow-first .scene-trigger-source-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.scene-edit-dialog--flow-first .scene-trigger-source-head span {
    color: var(--ops-text);
    font-size: 12px;
    font-weight: 850;
}

.scene-edit-dialog--flow-first .scene-trigger-source-select {
    width: min(220px, 100%);
    height: 32px;
    border: 1px solid var(--ops-line);
    border-radius: 8px;
    background: var(--ops-row);
    color: var(--ops-text);
    font-size: 12px;
    font-weight: 800;
}

.scene-edit-dialog--flow-first .scene-trigger-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.scene-edit-dialog--flow-first .scene-trigger-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 999px;
    background: #EFF6FF;
    color: #1D4ED8;
    font-size: 12px;
    font-weight: 850;
}

.scene-edit-dialog--flow-first .scene-trigger-source-chip button {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.12);
    color: #1D4ED8;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.scene-edit-dialog--flow-first .scene-trigger-empty {
    padding: 14px;
    border: 1px dashed var(--ops-line-soft);
    border-radius: 10px;
    background: var(--ops-row);
}

.scene-edit-dialog--flow-first .scene-trigger-empty--compact {
    padding: 8px 10px;
}

.scene-edit-dialog--flow-first .scene-trigger-block {
    padding: 10px;
    border-radius: 10px;
    background: var(--ops-row);
}

.scene-edit-dialog--flow-first .scene-trigger-row {
    display: grid;
    grid-template-columns: 26px 64px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.scene-edit-dialog--flow-first .scene-trigger-interval-label {
    grid-column: span 3;
    justify-content: space-between;
}

.scene-edit-dialog--flow-first .scene-trigger-conditions {
    margin-top: 8px;
    padding-left: 0;
}

.scene-edit-dialog--flow-first .scene-trigger-conditions span {
    color: var(--ops-muted);
    font-size: 11px;
}

.scene-edit-dialog--flow-first .scene-edit-footer {
    min-height: 58px;
    padding: 10px 18px;
}

.scene-edit-dialog--flow-first .scene-edit-btn {
    min-height: 34px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 850;
}

@media (max-width: 1180px) {
    .scene-edit-body--flow-first {
        grid-template-columns: minmax(0, 1fr);
        overflow-y: auto;
    }

    .scene-edit-rail {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
    }

    .scene-flow-editor-host {
        min-height: 620px;
    }
}

@media (max-width: 768px) {
    .scene-edit-modal {
        padding: 0;
    }

    .scene-edit-dialog--flow-first {
        width: 100%;
        height: min(100dvh, 100vh);
        border-radius: 20px 20px 0 0;
    }

    .scene-edit-body--flow-first {
        padding: 10px;
    }

    .scene-flow-workbench-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .scene-flow-editor-host {
        min-height: 560px;
    }

    .scene-edit-dialog--flow-first .flow-editor {
        height: 560px;
        min-height: 560px;
    }

    .scene-edit-dialog--flow-first .flow-editor-sidebar {
        width: 100%;
        max-height: 190px;
    }

    .scene-edit-dialog--flow-first .agent-palette {
        grid-template-columns: 1fr;
    }

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

    .scene-edit-dialog--flow-first .scene-schedule-form,
    .scene-edit-compact-grid {
        grid-template-columns: 1fr;
    }

    .scene-edit-dialog--flow-first .scene-schedule-field--switch,
    .scene-edit-dialog--flow-first .scene-schedule-field--mode {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .scene-center {
        padding: 12px;
    }

    .scene-center-header {
        display: none;
    }

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

    .scene-card-top {
        min-height: 70px;
        padding: 12px;
    }

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