/* ==========================================================================
   Huakong Electric Dify Agent Portal & Studio - Global Style Sheet
   Author: Antigravity AI Pair
   Theme: High-Tech Industrial Dark, Glassmorphism, Neon Blue & Red Accent Glows
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #070913;
    --bg-deep: #030408;
    --bg-panel: rgba(15, 23, 42, 0.45);
    --bg-panel-solid: #0d1326;
    --bg-panel-hover: rgba(30, 41, 59, 0.65);
    --primary-color: #0082c9;
    --primary-glow: rgba(0, 130, 201, 0.4);
    --primary-light: #38bdf8;
    --accent-color: #ff2e2e;
    --accent-glow: rgba(255, 46, 46, 0.35);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #475569;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.16);
    --border-glow: rgba(0, 130, 201, 0.3);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --glass-blur: blur(16px);
    --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets and scrollbar customization */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 130, 201, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 46, 46, 0.05) 0%, transparent 40%),
        linear-gradient(to bottom, #070913, #030408);
    background-attachment: fixed;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 130, 201, 0.2); }
    50% { box-shadow: 0 0 25px rgba(0, 130, 201, 0.45); }
}

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

@keyframes typewriting {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blinkCursor {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color); }
}

/* Layout Utilities */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
}
.glass-panel:hover {
    border-color: var(--border-color-hover);
}

.glass-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: var(--transition-smooth);
}
.glass-card:hover {
    border-color: var(--primary-glow);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 8px 24px rgba(0, 130, 201, 0.15);
    transform: translateY(-4px);
}

/* Header Styles */
.app-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(7, 9, 19, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 48px;
    cursor: pointer;
}

.brand-logo-svg {
    height: 44px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-item {
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    border-color: rgba(0, 130, 201, 0.3);
    background: rgba(0, 130, 201, 0.1);
    box-shadow: 0 0 15px rgba(0, 130, 201, 0.1) inset;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.status-badge.is-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
}

.status-badge.is-warning .status-dot {
    background-color: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.auth-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition-smooth);
}

.auth-user-btn:hover {
    color: var(--text-main);
    border-color: var(--primary-glow);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    cursor: pointer;
    transition: var(--transition-smooth);
}
.user-avatar:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Dynamic View Switcher Container */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.site-footer {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 8px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(7, 9, 19, 0.72);
    color: var(--text-dark);
    font-size: 12px;
    flex-wrap: wrap;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary-light);
}

.approval-page {
    flex: 1;
    overflow-y: auto;
    padding: 26px 30px 34px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.approval-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.approval-toolbar h1 {
    font-size: 28px;
    color: var(--text-main);
    margin-bottom: 6px;
}

.approval-toolbar p,
.approval-hint,
.approval-section-title span {
    color: var(--text-muted);
    font-size: 13px;
}

.approval-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 0.95fr);
    gap: 18px;
}

.approval-form-panel,
.approval-template-panel,
.approval-list-panel {
    padding: 20px;
}

.approval-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.approval-section-title h2 {
    color: var(--text-main);
    font-size: 17px;
}

.approval-form,
.approval-template-editor,
.approval-dynamic-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.approval-actions,
.approval-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.approval-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.approval-check input {
    accent-color: var(--primary-color);
}

.approval-table-wrap {
    overflow-x: auto;
}

.approval-filters .config-select {
    min-width: 150px;
}

@media (max-width: 1100px) {
    .approval-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .approval-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .approval-page {
        padding: 18px;
    }
}

.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}

.view-panel.active-view {
    opacity: 1;
    visibility: visible;
    z-index: 20;
    animation: fadeIn 0.4s ease-out forwards;
}

/* ==========================================================================
   VIEW 1: AGENT SQUARE (智能体广场)
   ========================================================================== */
.square-view {
    overflow-y: auto;
    padding: 40px 60px;
}

.hero-section {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.hero-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 30%, var(--primary-light) 70%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.search-container {
    max-width: 650px;
    margin: 0 auto;
    position: relative;
}

.search-bar-wrapper {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 6px 6px 6px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}
.search-bar-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-glow);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 16px;
    font-family: var(--font-sans);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-btn:hover {
    background: #0093e2;
    box-shadow: 0 0 12px var(--primary-glow);
}

.tags-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.category-tab:hover, .category-tab.active {
    color: #fff;
    background: rgba(0, 130, 201, 0.15);
    border-color: var(--primary-color);
}

.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.agent-card {
    display: flex;
    flex-direction: column;
    height: 250px;
    padding: 24px;
    cursor: pointer;
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.agent-card-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 130, 201, 0.2), rgba(255, 46, 46, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.agent-card-title-group {
    flex: 1;
    overflow: hidden;
}

.agent-card-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.agent-card-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 130, 201, 0.1);
    border: 1px solid rgba(0, 130, 201, 0.2);
    color: var(--primary-light);
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.agent-card-desc {
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 20px;
}

.agent-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
    font-size: 12px;
    color: var(--text-muted);
}

.agent-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-action-btn {
    background: transparent;
    color: var(--primary-light);
    border: 1px solid rgba(0, 130, 201, 0.3);
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.agent-card:hover .agent-action-btn {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 130, 201, 0.3);
}

/* ==========================================================================
   VIEW 2: DEVELOPER STUDIO (智能体配置三栏中心)
   ========================================================================== */
.studio-view {
    display: flex;
    height: 100%;
}

/* Left Sidebar - Submenu */
.studio-sidebar {
    width: 240px;
    border-right: 1px solid var(--border-color);
    background: rgba(7, 9, 19, 0.4);
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    gap: 6px;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 15px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sidebar-item:hover, .sidebar-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-item.active {
    background: rgba(0, 130, 201, 0.08);
    color: var(--primary-light);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
}

/* Main Workspace inside Studio */
.studio-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Middle Column - Configurations */
.studio-config-column {
    flex: 1.2;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(10, 15, 30, 0.2);
}

.studio-column-header {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
}

.column-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}
.btn-primary:hover {
    background: #0096e8;
    box-shadow: 0 0 10px var(--primary-glow);
}

.studio-config-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-label {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.config-label-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.config-input, .config-select, .config-textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition-smooth);
}

.config-input:focus, .config-select:focus, .config-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(0, 130, 201, 0.25);
    outline: none;
    background: rgba(15, 23, 42, 0.8);
}

.config-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* Prompt Optimization Action */
.optimize-prompt-btn {
    background: rgba(0, 130, 201, 0.1);
    border: 1px solid rgba(0, 130, 201, 0.2);
    color: var(--primary-light);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 4px;
}
.optimize-prompt-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Knowledge Base list selections in Editor */
.kb-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 5px;
}

.kb-select-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.kb-select-card:hover {
    background: rgba(255, 255, 255, 0.04);
}
.kb-select-card.selected {
    border-color: var(--primary-color);
    background: rgba(0, 130, 201, 0.08);
}

.kb-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
}
.kb-select-card.selected .kb-checkbox {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.kb-card-info {
    flex: 1;
    overflow: hidden;
}
.kb-card-name {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.kb-card-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Range Slider Styles */
.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
.config-range {
    flex: 1;
    accent-color: var(--primary-color);
    height: 6px;
    border-radius: 3px;
    outline: none;
}
.slider-value {
    width: 40px;
    text-align: right;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary-light);
}

/* Right Column - Preview Sandbox */
.studio-preview-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(3, 4, 8, 0.4);
}

.preview-agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.preview-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.preview-name {
    font-weight: 700;
    font-size: 14px;
}
.preview-tag {
    background: rgba(255, 255, 255, 0.08);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Chat Interface Styling (Shared by Preview Sandbox & Solo Chat View) */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message-bubble {
    display: flex;
    gap: 14px;
    max-width: 85%;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.message-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-bubble.user .message-avatar {
    background: rgba(255, 255, 255, 0.1);
}

.message-bubble.assistant .message-avatar {
    background: linear-gradient(135deg, rgba(0, 130, 201, 0.2), rgba(255, 46, 46, 0.1));
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.message-bubble.user .message-text {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.message-bubble.assistant .message-text {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

/* Stream / Thought Process Indicator */
.thought-process {
    background: rgba(0, 130, 201, 0.05);
    border-left: 2px solid var(--primary-color);
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-radius: 0 4px 4px 0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thought-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 130, 201, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Citation Sources RAG */
.citations-wrapper {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.citations-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.citation-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 12px;
    color: var(--primary-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    width: fit-content;
}
.citation-item:hover {
    background: rgba(0, 130, 201, 0.1);
    border-color: var(--primary-color);
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 12px;
}

.attachment-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip button {
    border: 0;
    background: none;
    color: var(--text-dark);
    cursor: pointer;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px 6px 4px 16px;
    transition: var(--transition-smooth);
}
.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.6);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 10px 0;
    resize: none;
    height: 40px;
    max-height: 120px;
}

.chat-input-actions {
    display: flex;
    gap: 4px;
}

.chat-action-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.chat-action-icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.send-msg-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.send-msg-btn:hover {
    background: #0098ec;
    box-shadow: 0 0 10px var(--primary-glow);
}

.send-msg-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    box-shadow: none;
}

.send-msg-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

.chat-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--text-dark);
}

/* ==========================================================================
   VIEW 3: KNOWLEDGE BASE MANAGER (知识库管理)
   ========================================================================== */
.kb-view {
    padding: 40px 60px;
    overflow-y: auto;
    height: 100%;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

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

.section-title {
    font-size: 26px;
    font-weight: 800;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.kb-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 200px;
}

.kb-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kb-icon-container {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(0, 130, 201, 0.1);
    border: 1px solid rgba(0, 130, 201, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-light);
}

.kb-status-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.kb-status-tag.indexing {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.kb-card-details {
    flex: 1;
}

.kb-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.kb-desc {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kb-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Vectorization progress visual */
.kb-progress-bar-bg {
    width: 70px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.kb-progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Add Knowledge Base Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 500px;
    max-width: 90%;
    padding: 30px;
    animation: fadeIn 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.login-panel {
    width: 380px;
    max-width: calc(100% - 32px);
    padding: 22px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-error {
    min-height: 18px;
    color: #ef4444;
    font-size: 12px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}
.modal-close:hover {
    color: white;
}

.drag-drop-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.01);
}
.drag-drop-area:hover {
    border-color: var(--primary-color);
    background: rgba(0, 130, 201, 0.04);
}

.drag-icon {
    font-size: 32px;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.drag-text {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 6px;
    font-weight: 600;
}

.drag-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.file-upload-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-name-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remove-file-btn {
    color: var(--accent-color);
    background: transparent;
    border: none;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-smooth);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   VIEW 4: WORKFLOW DESIGNER (工作流引擎可视化)
   ========================================================================== */
.workflow-view {
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workflow-canvas-container {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #030408;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0),
        radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-canvas {
    width: 1400px;
    height: 800px;
    position: relative;
}

/* SVG Overlay for drawing Node connections */
.workflow-svg-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    fill: none;
    stroke: rgba(0, 130, 201, 0.35);
    stroke-width: 3;
    stroke-linecap: round;
    transition: var(--transition-smooth);
}
.connection-line.active {
    stroke: var(--primary-color);
    stroke-dasharray: 8 4;
    animation: flowDash 30s linear infinite;
}

@keyframes flowDash {
    to { stroke-dashoffset: -1000; }
}

/* Node Elements */
.wf-node {
    position: absolute;
    width: 200px;
    background: rgba(13, 19, 38, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 5;
    cursor: grab;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: none;
}
.wf-node:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(0, 130, 201, 0.2);
}
.wf-node.active-node {
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(0, 130, 201, 0.4);
}

.wf-node-header {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px 10px 0 0;
}

.wf-node.node-start .wf-node-header { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.wf-node.node-kb .wf-node-header { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.wf-node.node-llm .wf-node-header { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.wf-node.node-code .wf-node-header { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.wf-node.node-end .wf-node-header { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.wf-node-body {
    padding: 12px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.4;
}

.wf-node-port {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #030408;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    z-index: 10;
}
.wf-node-port.port-in {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}
.wf-node-port.port-out {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}
.wf-node:hover .wf-node-port {
    border-color: var(--primary-color);
}

/* Connection points indicator in workflow */
.workflow-details-panel {
    width: 320px;
    border-left: 1px solid var(--border-color);
    background: rgba(7, 9, 19, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    padding: 25px;
    gap: 20px;
    overflow-y: auto;
}

.node-param-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}
.node-param-label {
    font-weight: 600;
    color: var(--text-muted);
}
.node-param-val {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Floating Action Button for Adding Nodes */
.wf-add-node-bar {
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 6px;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 50;
}

.wf-tool-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 6px;
}
.wf-tool-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Responsive & Helper Utilities
   ========================================================================== */
@media (max-width: 1024px) {
    .studio-view {
        flex-direction: column;
    }
    .studio-sidebar {
        width: 100%;
        height: 60px;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 5px 15px;
    }
    .sidebar-title { display: none; }
    .studio-workspace {
        flex-direction: column;
        flex: 1;
    }
    .studio-config-column {
        flex: 1;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .square-view {
        padding: 20px;
    }
    .hero-title { font-size: 30px; }
    .agent-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; } /* Could trigger a drawer in production */
}

/* Custom Highlight Effect for Code Editor Text */
.code-editor-style {
    font-family: 'Consolas', 'Fira Code', monospace;
    font-size: 13px;
    background: #02040a;
}

/* ==========================================================================
   BACKEND ADMIN STYLING EXTENSIONS
   ========================================================================== */
.admin-view {
    display: flex;
    height: 100%;
}

.admin-panel-content {
    animation: fadeIn 0.4s ease-out forwards;
}

.bar-animate {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
.bar-animate:hover {
    transform: scaleY(1.04) translateY(-2px);
    filter: brightness(1.2);
}

.status-badge .status-dot {
    position: relative;
}
.status-badge .status-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulseBadge 1.8s infinite;
}

.status-badge.is-warning .status-dot::after {
    box-shadow: 0 0 8px #f59e0b;
}

@keyframes pulseBadge {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.4); opacity: 0; }
}

table th {
    font-weight: 600;
}
table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s ease;
}
table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 1024px) {
    .admin-view {
        flex-direction: column;
    }
}
