/* ===== 遮罩层 ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

/* ===== 面板主体 ===== */
.panel {
    width: 720px;
    max-width: 95vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

/* ===== 头部 ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    border-radius: 16px 16px 0 0;
    gap: 12px;
}

.headerLeft {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
}

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

.statusDot.running {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    animation: pulse 1.5s infinite;
}

.statusDot.stopped {
    background: #f59e0b;
}

.statusDot.completed {
    background: #6366f1;
}

.statusDot.failed {
    background: #ef4444;
}

.statusDot.unknown {
    background: #9ca3af;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.statusBadge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    background: #f0f0f0;
    color: #555;
}

.badge_running {
    background: #dcfce7;
    color: #16a34a;
}

.badge_stopped {
    background: #fef3c7;
    color: #d97706;
}

.badge_completed {
    background: #ede9fe;
    color: #7c3aed;
}

.badge_failed {
    background: #fee2e2;
    color: #dc2626;
}

.headerRight {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

.btnPause {
    background: #fff7ed;
    color: #d97706;
    border-color: #d97706;
}

.btnPause:hover:not(:disabled) {
    background: #fed7aa;
}

.btnResume {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #16a34a;
}

.btnResume:hover:not(:disabled) {
    background: #bbf7d0;
}

.btnStop {
    background: #fff1f2;
    color: #e11d48;
    border-color: #e11d48;
}

.btnStop:hover:not(:disabled) {
    background: #fecdd3;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.closeBtn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.15s;
}

.closeBtn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ===== 控制台日志区 ===== */
.logSection {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 20px 8px;
}

.logHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.tabs {
    display: flex;
    gap: 16px;
}

.tabItem {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tabActive {
    color: #f8fafc;
}

.tabActive::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: #3b82f6;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dotOk {
    background: #10b981;
}

.dotOff {
    background: #ef4444;
}

.logLabel {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.traceIdLabel {
    font-size: 11px;
    color: #94a3b8;
    font-family: "SF Mono", "Fira Code", monospace;
}

.logContainer {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #0f172a;
    font-family:
        "JetBrains Mono",
        "Fira Code",
        "Menlo",
        monospace;
    font-size: 13px;
    line-height: 1.6;
}

.logContainerBackend {
    background: #000;
}

.logLine {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    word-break: break-all;
}

.backendLogLine {
    display: flex;
    gap: 10px;
    margin-bottom: 2px;
}

.logTime {
    color: #475569;
    flex-shrink: 0;
}

.logTag {
    font-weight: 700;
    flex-shrink: 0;
}

.logText {
    color: #cbd5e1;
    word-break: break-all;
}

.log_system .logTag {
    color: #60a5fa;
}

.log_system .logText {
    color: #94a3b8;
    font-style: italic;
}

.log_agent .logTag {
    color: #34d399;
}

.log_agent .logText {
    color: #d1fae5;
}

.log_tool .logTag {
    color: #f59e0b;
}

.log_tool .logText {
    color: #fde68a;
}

.log_result .logTag {
    color: #a78bfa;
}

.log_result .logText {
    color: #ddd6fe;
}

.log_error .logTag {
    color: #f87171;
}

.log_error .logText {
    color: #fca5a5;
}

.log_warn .logTag {
    color: #fb923c;
}

.log_warn .logText {
    color: #fed7aa;
}

/* ===== 操作按钮区 ===== */
.actionSection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 20px;
}

.actionCard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    background: #f8f7ff;
    border: 1.5px solid #e0e7ff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    font-weight: 600;
    color: #4338ca;
}

.actionCard:hover:not(:disabled) {
    background: #ede9fe;
    border-color: #c4b5fd;
}

.actionCard:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
}

.actionCard.actionCardActive {
    background: #ede9fe;
    border-color: #a78bfa;
}

.actionIcon {
    font-size: 22px;
    line-height: 1;
}

.actionLabel {
    font-size: 13px;
}

/* ===== 干预消息输入区 ===== */
.interventionSection {
    display: flex;
    gap: 10px;
    padding: 8px 20px 14px;
    align-items: flex-end;
}

.interventionInput {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.15s;
    min-height: 60px;
}

.interventionInput:focus {
    border-color: #6366f1;
    background: #fff;
}

.interventionInput::placeholder {
    color: #94a3b8;
}

.submitBtn {
    height: 40px;
    padding: 0 18px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}

.submitBtn:hover:not(:disabled) {
    background: #4338ca;
}

.submitBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== 底部状态栏 ===== */
.footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    font-size: 12px;
    color: #64748b;
    border-radius: 0 0 16px 16px;
}

.wsStatus {
    margin-left: auto;
    font-weight: 500;
}

.wsOk {
    color: #16a34a;
}

.wsOff {
    color: #9ca3af;
}