/* 一人公司板块样式 */

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* 表格样式 */
.agent-table {
    width: 100%;
    border-collapse: collapse;
}

.agent-table th,
.agent-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.agent-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #6b7280;
    font-size: 14px;
}

.agent-table td {
    color: #1f2937;
    font-size: 14px;
}

.agent-table tr:hover {
    background: #f9fafb;
}

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.status-idle {
    background: #e5e7eb;
    color: #6b7280;
}

.status-working {
    background: #dbeafe;
    color: #166534;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Agent节点样式 */
.agent-node {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: grab;
    min-width: 200px;
    z-index: 10;
}

.agent-node:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.agent-node.dragging {
    cursor: grabbing;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.node-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.node-info {
    text-align: center;
}

.node-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.node-status {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

/* Agent详情样式 */
.agent-detail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.agent-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.agent-detail-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-detail-icon .material-symbols-outlined {
    font-size: 32px;
}

.agent-detail-info h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.agent-type {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.agent-detail-section {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.agent-detail-section h5 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item .label {
    font-size: 12px;
    color: #6b7280;
}

.info-item .value {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

/* 任务历史样式 */
.task-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.task-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.task-time {
    font-size: 12px;
    color: #6b7280;
}

/* 统计网格样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
}

/* 按钮样式 */
.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #f3f4f6;
}

.btn-danger {
    color: #ef4444;
}

.btn-danger:hover {
    background: #fee2e2;
}

/* 通知样式 */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1f2937;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* 加载状态样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    margin: 0;
    font-size: 16px;
    color: #1f2937;
}

/* 连接线样式 */
.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ===================== */
/* 树状图样式 */
/* ===================== */

.tree-diagram-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding: 30px 20px 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    min-height: 420px;
    position: relative;
}

.tree-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: fit-content;
    padding: 10px 0;
}

.tree-level {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    width: 100%;
}

.tree-level-0 {
    margin-bottom: 0;
}

.tree-level-1 {
    margin-top: 50px;
}

.tree-level-2 {
    margin-top: 50px;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0 10px;
}

.tree-connector-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.tree-connector-group .tree-connector-line {
    width: 2px;
    height: 50px;
    background: linear-gradient(180deg, #c7d2fe 0%, #a5b4fc 100%);
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
}

.tree-connector-horizontal {
    position: relative;
    height: 2px;
    background: linear-gradient(90deg, #c7d2fe 0%, #a5b4fc 50%, #c7d2fe 100%);
    margin: 0 auto;
    width: 80%;
    max-width: 600px;
    margin-bottom: 0;
}

.tree-connector-horizontal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #c7d2fe 0%, #a5b4fc 50%, #c7d2fe 100%);
}

/* 树节点基础样式 */
.tree-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.tree-node:hover {
    transform: translateY(-4px);
}

.tree-node:active {
    transform: translateY(-1px);
}

/* 创始人节点 - 第一层 */
.tree-node-founder .tree-node-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px -5px rgba(99, 102, 241, 0.5), 0 0 0 4px rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tree-node-founder .tree-node-avatar::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed rgba(99, 102, 241, 0.3);
    animation: tree-rotate-slow 20s linear infinite;
}

.tree-node-founder:hover .tree-node-avatar {
    box-shadow: 0 12px 35px -5px rgba(99, 102, 241, 0.6), 0 0 0 6px rgba(99, 102, 241, 0.15);
}

.tree-node-founder .tree-node-avatar .material-symbols-outlined {
    font-size: 36px;
    color: white;
}

.tree-node-founder .tree-node-label {
    font-size: 15px;
    font-weight: 700;
    color: #1e1b4b;
    margin-top: 12px;
    text-align: center;
    letter-spacing: 0.5px;
}

.tree-node-founder .tree-node-sublabel {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    text-align: center;
}

/* 经理人节点 - 第二层 */
.tree-node-manager .tree-node-avatar {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px -4px rgba(59, 130, 246, 0.5), 0 0 0 3px rgba(59, 130, 246, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tree-node-manager:hover .tree-node-avatar {
    box-shadow: 0 10px 30px -4px rgba(59, 130, 246, 0.6), 0 0 0 5px rgba(59, 130, 246, 0.15);
    transform: scale(1.05);
}

.tree-node-manager .tree-node-avatar .material-symbols-outlined {
    font-size: 30px;
}

.tree-node-alex .tree-node-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 6px 20px -4px rgba(99, 102, 241, 0.5), 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tree-node-alex:hover .tree-node-avatar {
    box-shadow: 0 10px 30px -4px rgba(99, 102, 241, 0.6), 0 0 0 5px rgba(99, 102, 241, 0.15);
}

.tree-node-alex .tree-node-label {
    color: #6366f1;
}

.tree-node-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-top: 2px;
}

.tree-node-manager .tree-node-avatar .material-symbols-outlined {
    color: white;
}

.tree-node-manager .tree-node-label {
    font-size: 14px;
    font-weight: 600;
    color: #1e3a5f;
    margin-top: 10px;
    text-align: center;
}

.tree-node-manager .tree-node-sublabel {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    text-align: center;
}

.tree-node-manager .tree-node-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    background: #dbeafe;
    color: #1d4ed8;
}

.tree-node-manager .tree-node-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    animation: tree-pulse-dot 2s ease-in-out infinite;
}

/* Agent节点 - 第三层 */
.tree-node-agent {
    position: relative;
}

.tree-node-agent .tree-node-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 20px;
    min-width: 160px;
    max-width: 200px;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tree-node-agent .tree-node-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
}

.tree-node-agent:hover .tree-node-card {
    box-shadow: 0 8px 25px -4px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: #c7d2fe;
}

.tree-node-agent .tree-node-card .tree-node-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    transition: transform 0.3s ease;
}

.tree-node-agent:hover .tree-node-card .tree-node-icon {
    transform: scale(1.1);
}

.tree-node-agent .tree-node-card .tree-node-icon .material-symbols-outlined {
    font-size: 22px;
    color: white;
}

.tree-node-agent .tree-node-card .tree-node-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-node-agent .tree-node-card .tree-node-task {
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-node-agent .tree-node-card .tree-node-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
}

.tree-node-agent .tree-node-card .tree-node-model-badge .material-symbols-outlined {
    font-size: 12px;
}

.tree-node-agent .tree-node-connector {
    width: 2px;
    height: 50px;
    background: linear-gradient(180deg, #c7d2fe 0%, #a5b4fc 100%);
    margin: 0 auto;
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
}

/* 树状图SVG连接线 */
.tree-svg-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.tree-svg-connections path {
    fill: none;
    stroke: #a5b4fc;
    stroke-width: 2;
    stroke-dasharray: 6 3;
    animation: tree-dash-flow 1.5s linear infinite;
}

/* 树状图动画 */
@keyframes tree-rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes tree-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes tree-dash-flow {
    to { stroke-dashoffset: -18; }
}

@keyframes tree-node-appear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes tree-connector-appear {
    from {
        opacity: 0;
        stroke-dashoffset: 100;
    }
    to {
        opacity: 1;
        stroke-dashoffset: 0;
    }
}

.tree-node {
    animation: tree-node-appear 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.tree-node-founder { animation-delay: 0s; }
.tree-node-manager { animation-delay: 0.2s; }
.tree-node-agent:nth-child(1) { animation-delay: 0.4s; }
.tree-node-agent:nth-child(2) { animation-delay: 0.5s; }
.tree-node-agent:nth-child(3) { animation-delay: 0.6s; }
.tree-node-agent:nth-child(4) { animation-delay: 0.7s; }
.tree-node-agent:nth-child(5) { animation-delay: 0.8s; }
.tree-node-agent:nth-child(6) { animation-delay: 0.9s; }

.tree-svg-connections path {
    animation: tree-connector-appear 0.6s ease-out both;
}

/* 展开折叠动画 */
.tree-level-2.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-level-2.expanded {
    max-height: 500px;
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.tree-toggle-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.tree-toggle-btn .material-symbols-outlined {
    font-size: 16px;
    color: #3b82f6;
    transition: transform 0.3s ease;
}

.tree-toggle-btn.collapsed .material-symbols-outlined {
    transform: rotate(0deg);
}

.tree-toggle-btn.expanded .material-symbols-outlined {
    transform: rotate(180deg);
}

/* Agent详情弹窗增强 */
.agent-detail-config {
    padding: 16px;
    background: #f0f9ff;
    border-radius: 8px;
    border: 1px solid #bae6fd;
}

.agent-detail-config h5 {
    color: #0369a1;
    margin-bottom: 12px;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e0f2fe;
}

.config-item:last-child {
    border-bottom: none;
}

.config-item .config-label {
    font-size: 12px;
    color: #64748b;
    min-width: 80px;
}

.config-item .config-value {
    font-size: 13px;
    color: #0c4a6e;
    font-weight: 500;
    word-break: break-all;
}

.config-item .config-value.masked {
    font-family: monospace;
    letter-spacing: 2px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .agent-node {
        min-width: 150px;
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .tree-diagram-container {
        padding: 20px 10px;
        min-height: 350px;
    }

    .tree-node-founder .tree-node-avatar {
        width: 64px;
        height: 64px;
    }

    .tree-node-founder .tree-node-avatar .material-symbols-outlined {
        font-size: 28px;
    }

    .tree-node-manager .tree-node-avatar {
        width: 56px;
        height: 56px;
    }

    .tree-node-manager .tree-node-avatar .material-symbols-outlined {
        font-size: 24px;
    }

    .tree-node-agent .tree-node-card {
        min-width: 130px;
        max-width: 160px;
        padding: 12px 14px;
    }

    .tree-level-1 {
        margin-top: 36px;
    }

    .tree-level-2 {
        margin-top: 36px;
        gap: 10px;
    }

    .tree-node-agent .tree-node-connector {
        height: 36px;
        top: -36px;
    }

    .tree-connector-group .tree-connector-line {
        height: 36px;
        top: -36px;
    }
}

@media (max-width: 480px) {
    .tree-level-2 {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tree-node-agent .tree-node-card {
        min-width: 120px;
        padding: 10px 12px;
    }

    .tree-node-agent .tree-node-card .tree-node-icon {
        width: 36px;
        height: 36px;
    }

    .tree-node-agent .tree-node-card .tree-node-icon .material-symbols-outlined {
        font-size: 18px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.agent-node,
.modal-content {
    animation: fadeIn 0.3s ease;
}

/* 滚动条样式 */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* === v1.2.5 === */
.tree-horizontal-container{width:100%;overflow-x:auto;overflow-y:hidden;padding:20px;background:linear-gradient(180deg,#f8fafc,#f1f5f9);border-radius:12px;border:1px solid #e2e8f0;min-height:200px}
.tree-horizontal{display:flex;flex-direction:row;align-items:center;justify-content:center;min-width:fit-content;padding:10px 0}
.h-node{display:flex;flex-direction:column;align-items:center;flex-shrink:0}
.h-connector{display:flex;align-items:center;flex-shrink:0;width:40px;height:2px;background:linear-gradient(90deg,#a5b4fc,#c7d2fe);margin:0 4px;position:relative}
.h-connector::after{content:"";position:absolute;right:-2px;top:-4px;width:0;height:0;border-left:8px solid #a5b4fc;border-top:5px solid transparent;border-bottom:5px solid transparent}
.h-node-founder .h-node-avatar{width:64px;height:64px;border-radius:50%;background:linear-gradient(135deg,#6366f1,#8b5cf6,#a855f7);display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px -4px rgba(99,102,241,.5),0 0 0 3px rgba(99,102,241,.1)}
.h-node-founder:hover .h-node-avatar{box-shadow:0 10px 30px -4px rgba(99,102,241,.6),0 0 0 5px rgba(99,102,241,.15);transform:scale(1.05)}
.h-node-founder .h-node-avatar .material-symbols-outlined{font-size:30px;color:#fff}
.h-node-founder .h-node-label{font-size:13px;font-weight:700;color:#1e1b4b;margin-top:8px;text-align:center}
.h-node-manager .h-node-avatar{width:56px;height:56px;border-radius:16px;background:linear-gradient(135deg,#6366f1,#8b5cf6);display:flex;align-items:center;justify-content:center;box-shadow:0 5px 16px -3px rgba(99,102,241,.5),0 0 0 3px rgba(99,102,241,.1);cursor:pointer}
.h-node-manager .h-node-badge{display:inline-block;padding:1px 6px;border-radius:8px;font-size:9px;font-weight:600;background:rgba(99,102,241,.1);color:#6366f1;border:1px solid rgba(99,102,241,.2);margin-top:2px}
.h-node-manager .h-node-status{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:2px 8px;border-radius:9999px;font-size:10px;font-weight:500;background:#dbeafe;color:#1d4ed8}
.h-node-manager .h-node-status .status-dot{width:5px;height:5px;border-radius:50%;background:#3b82f6}
/* Icon fallback: Material Symbols overlays fallback letter via CSS Grid stacking */
.h-node-avatar, .h-node-icon{display:grid!important;place-items:center!important}
.h-node-avatar>*,.h-node-icon>*{grid-area:1/1/2/2;display:flex;align-items:center;justify-content:center}
.h-node-avatar .material-symbols-outlined,.h-node-icon .material-symbols-outlined{z-index:2;position:relative}
.icon-fallback{z-index:1;font-weight:700}
/* When Material Symbols font is missing, hide raw text and show fallback */
.ms-fallback .material-symbols-outlined{font-size:0!important;width:0!important;height:0!important;overflow:hidden!important}
.ms-fallback .icon-fallback{display:flex!important}
/* 分支Agent图标缩小为原有大小的一半 */
.h-node-agent .h-node-card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;padding:8px 10px;min-width:80px;max-width:100px;box-shadow:0 2px 6px -1px rgba(0,0,0,.06);text-align:center;position:relative;overflow:hidden;cursor:pointer}
.h-node-agent .h-node-card::before{content:"";position:absolute;top:0;left:0;right:0;height:2px}
.h-node-agent:hover .h-node-card{box-shadow:0 4px 12px -2px rgba(0,0,0,.1);transform:translateY(-2px);border-color:#c7d2fe}
.h-node-agent .h-node-card .h-node-icon{width:22px;height:22px;border-radius:6px;display:flex;align-items:center;justify-content:center;margin:0 auto 4px}
.h-node-agent .h-node-card .h-node-icon .material-symbols-outlined{font-size:13px;color:#fff}
.h-node-agent .h-node-card .h-node-name{font-size:10px;font-weight:600;color:#1f2937;margin:0 0 1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}
.h-node-agent .h-node-card .h-node-task{font-size:9px;color:#9ca3af;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}
.h-node-agent .h-node-card .h-node-model-badge{display:inline-flex;align-items:center;gap:2px;margin-top:3px;padding:1px 4px;border-radius:4px;font-size:8px;font-weight:500;background:#f3f4f6;color:#6b7280;line-height:1.2}
/* === Fixed Input Bar (永久固化在页面底部) === */
.fixed-input-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 10px 24px 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.95) 12%, rgba(255,255,255,1) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.input-bar-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.06);
    transition: box-shadow .3s, border-color .3s;
}
.input-bar-wrapper:focus-within {
    border-color: rgba(59,130,246,.25);
    box-shadow: 0 2px 12px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.08), 0 0 0 3px rgba(59,130,246,.08);
}

/* ---- 顶部工具栏 ---- */
.input-bar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 2px 10px;
}
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.tool-btn .material-symbols-outlined {
    font-size: 17px;
}
.tool-btn:hover {
    background: #f3f4f6;
    color: #374151;
}
.tool-btn:active {
    background: #e5e7eb;
}
.toolbar-divider {
    width: 1px;
    height: 18px;
    background: rgba(0,0,0,.08);
    margin: 0 4px;
}

/* ---- 模式选择器 ---- */
.mode-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.mode-trigger .material-symbols-outlined {
    font-size: 17px;
    color: #9ca3af;
}
.mode-trigger .mode-arrow {
    font-size: 16px !important;
    transition: transform .2s;
}
.mode-selector.open .mode-arrow {
    transform: rotate(180deg);
}
.mode-trigger:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ---- 输入行 ---- */
.input-bar-main {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 4px 12px 12px 12px;
}
.ib-input {
    flex: 1;
    min-height: 48px;
    max-height: 160px;
    padding: 12px 0 12px 6px;
    border: none;
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    overflow-y: auto;
    outline: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    caret-color: #2563eb;
}
.ib-input:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}

/* ---- 发送按钮 ---- */
.ib-send {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    border: none;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0;
    transition: background .2s, transform .15s, box-shadow .2s;
    align-self: flex-end;
    margin-bottom: 4px;
}
.ib-send .material-symbols-outlined {
    font-size: 20px;
}
.ib-send:hover {
    background: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(37,99,235,.35);
}
.ib-send:active {
    transform: scale(.94);
}

/* ---- 附件预览 ---- */
.chat-attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 18px 10px 18px;
    border-top: 1px solid rgba(0,0,0,.04);
}
.chat-attachments-preview .chat-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 4px;
    background: #f8fafc;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 20px;
    font-size: 12px;
    color: #374151;
    transition: border-color .15s;
}
.chat-attachments-preview .chat-attachment-item:hover {
    border-color: rgba(0,0,0,.12);
}
.chat-attachments-preview .chat-attachment-item .file-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}
.chat-attachments-preview .chat-attachment-item .file-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #374151;
    font-weight: 500;
}
.chat-attachments-preview .chat-attachment-item .remove-attachment {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    color: #9ca3af;
    border-radius: 50%;
    transition: color .15s, background .15s;
    margin-left: 1px;
}
.chat-attachments-preview .chat-attachment-item .remove-attachment:hover {
    color: #ef4444;
    background: rgba(239,68,68,.08);
}

.has-fixed-input { padding-bottom: 170px !important; }

/* ---- 模式下拉菜单 ---- */
.mode-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    z-index: 100;
    min-width: 170px;
    overflow: hidden;
    padding: 4px;
}
.mode-selector.open .mode-dropdown {
    display: block;
}
.mode-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    color: #475569;
    font-size: 13px;
    border-radius: 10px;
    transition: background .12s, color .12s;
}
.mode-dropdown-item .material-symbols-outlined {
    font-size: 18px;
    color: #9ca3af;
}
.mode-dropdown-item:hover {
    background: #f3f4f6;
    color: #1e293b;
}
.mode-dropdown-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}
.mode-dropdown-item.active .material-symbols-outlined {
    color: #2563eb;
}
