/* ===== Page Styles ===== */

/* Page header */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 28px; font-weight: 300; color: var(--text-primary); }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--border-color); }
.tab {
    padding: 8px 16px; font-size: 13px; font-weight: 400;
    color: var(--text-secondary); cursor: pointer; border: none;
    background: none; border-bottom: 2px solid transparent;
    margin-bottom: -2px; font-family: var(--font-family);
    transition: all 0.15s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); font-weight: 500; border-bottom-color: var(--text-primary); }
.tab .badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: #2196F3; color: #FFFFFF; font-size: 10px;
    min-width: 16px; height: 16px; border-radius: 50%; margin-left: 4px;
    padding: 0 4px;
}

/* Table */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--primary-bg); border-radius: 8px; border: none; }
.data-table thead th {
    text-align: left; padding: 10px 16px; font-size: 12px;
    font-weight: 600; color: #1a1a2e;
    border-bottom: 1px solid var(--border-color); background: var(--primary-bg);
}
.data-table thead th:first-child { border-top-left-radius: 8px; }
.data-table thead th:last-child { border-top-right-radius: 8px; }
.data-table tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
.data-table tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
.data-table tbody td {
    padding: 10px 16px; font-size: 13px; border-bottom: 1px solid #f0f0f0;
}
.data-table tbody tr:hover { background: #FAFAFA; }
.status-available { color: var(--success-bg); display: flex; align-items: center; gap: 4px; }
.status-available::before { content: '✓'; font-weight: 700; }
.actions-menu { cursor: pointer; color: var(--text-muted); font-size: 16px; letter-spacing: 2px; }

/* Section card */
.section-card {
    background: var(--primary-bg); border-radius: 8px;
    border: 1px solid var(--border-color); padding: 20px; margin-bottom: 16px;
}
.section-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.section-card .subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }

/* Integration action cards */
.action-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.action-card {
    background: var(--primary-bg); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 16px; display: flex; align-items: flex-start;
    gap: 12px; cursor: pointer; transition: all 0.15s;
}
.action-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-color: #ccc; }
.action-card-icon {
    width: 32px; height: 32px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 16px;
}
.action-card-body { flex: 1; min-width: 0; }
.action-card-body h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.action-card-body p { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.action-card .add-btn {
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #1a1a2e; flex-shrink: 0; font-size: 21px;
}
.action-card .add-btn:hover { background: none; color: #4200DB; }

/* Collapsible section */
.collapsible-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; padding: 12px 0;
}
.collapsible-header svg { transition: transform 0.2s; }

/* Flow cards */
.flow-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.flow-card {
    background: var(--primary-bg); border: 1px solid #e5e7eb;
    border-radius: 14px; padding: 20px; transition: all 0.15s;
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: 160px; position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.flow-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.flow-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 8px; padding-right: 24px; color: #16191f; }
.flow-card p { font-size: 13px; color: #6b7280; line-height: 1.5; flex: 1; margin-bottom: 12px; }
.flow-card-footer {
    font-size: 12px; color: #9ca3af; margin-top: auto;
    padding-top: 8px;
}
.flow-card-footer .owner { display: block; margin-bottom: 4px; }
.flow-card-footer .meta { display: flex; justify-content: space-between; }
.flow-card .menu-dots {
    position: absolute; top: 12px; right: 12px;
    cursor: pointer; color: var(--text-muted); font-size: 14px;
}
.flow-badge {
    display: inline-block; padding: 1px 4px; border-radius: 3px;
    font-size: 8px; font-weight: 500; letter-spacing: 0.2px;
    background: #f0f0f5; color: #6b7280;
    transform-origin: left top;
}

/* Filter bar */
.filter-bar {
    display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-search {
    display: flex; align-items: center; gap: 4px;
    border: 1px solid var(--border-color); border-radius: 4px;
    padding: 5px 8px; background: var(--primary-bg);
}
.filter-search input {
    border: none; outline: none; font-size: 12px; width: 120px;
    font-family: var(--font-family);
}
.filter-search svg { opacity: 0.4; }
.filter-select {
    padding: 5px 10px; border: 1px solid var(--border-color);
    border-radius: 4px; font-size: 12px; background: var(--primary-bg);
    cursor: pointer; font-family: var(--font-family);
}
.filter-bar .view-toggle { margin-left: auto; display: flex; gap: 2px; }
.view-toggle button {
    padding: 5px 8px; border: 1px solid var(--border-color);
    background: var(--primary-bg); cursor: pointer; display: flex;
    align-items: center;
}
.view-toggle button:first-child { border-radius: 4px 0 0 4px; }
.view-toggle button:last-child { border-radius: 0 4px 4px 0; }
.view-toggle button.active { background: #E8E8E8; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border-radius: 6px; font-size: 12px;
    font-weight: 500; cursor: pointer; border: none;
    font-family: var(--font-family); transition: all 0.15s;
}
.btn-primary { background: var(--visualization-bg); color: white; }
.btn-primary:hover { background: #5530e0; }
.btn-secondary { background: var(--secondary-bg); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: #ECECF0; }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* Home cards */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.home-card {
    background: var(--primary-bg); border-radius: 8px; padding: 18px;
    border: 1px solid var(--border-color); cursor: pointer; transition: all 0.15s;
}
.home-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.07); transform: translateY(-1px); }
.home-card .card-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.home-card .card-icon.purple { background: #EDE7F6; color: #6842FF; }
.home-card .card-icon.blue { background: #E3F2FD; color: #1565C0; }
.home-card .card-icon.green { background: #E8F5E9; color: #27700E; }
.home-card .card-icon.orange { background: #FFF3E0; color: #E65100; }
.home-card .card-icon.pink { background: #FCE4EC; color: #C82745; }
.home-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.home-card p { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }

/* Create flow button */
.btn-create-flow {
    background: #5b21b6; color: white;
    padding: 8px 20px; border-radius: 8px; border: none;
    font-size: 13px; font-weight: 500; cursor: pointer;
    font-family: var(--font-family);
}
.btn-create-flow:hover { background: #4c1d95; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state h3 { font-size: 15px; margin-bottom: 6px; color: var(--text-primary); }
.empty-state p { font-size: 12px; margin-bottom: 14px; }


/* ===== Home Page - QuickSight style ===== */
.home-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.home-header h1{font-size:24px;font-weight:300;color:var(--text-primary)}
.btn-add-widget{background:none;border:none;color:#4200DB;font-size:13px;cursor:pointer;font-family:var(--font-family);display:flex;align-items:center;gap:4px}
.btn-add-widget:hover{text-decoration:underline}

.features-section{background:var(--primary-bg);border:1px solid var(--border-color);border-radius:12px;padding:20px;margin-bottom:20px}
.features-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.features-title{font-size:14px;font-weight:600;color:var(--text-primary)}
.features-actions{display:flex;align-items:center;gap:12px}
.show-all-link{color:#4200DB;font-size:12px;cursor:pointer;text-decoration:none}
.show-all-link:hover{text-decoration:underline}
.close-features{background:none;border:none;font-size:18px;color:var(--text-muted);cursor:pointer}

.features-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.feature-card{border-radius:8px;overflow:hidden;cursor:pointer;transition:box-shadow .2s;background:#f9f9fb;border:1px solid #e8e8e8}
.feature-card:hover{box-shadow:0 4px 16px rgba(0,0,0,.1)}
.feature-img{height:140px;display:flex;align-items:center;justify-content:center;border-radius:8px 8px 0 0;overflow:hidden}
.feature-info{display:flex;align-items:center;gap:8px;padding:14px 16px 6px}
.feature-info h3{font-size:13px;font-weight:600}
.feature-icon{width:24px;height:24px;border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.feature-icon.purple{background:#e8e6ff;color:#4200DB}
.feature-icon.gradient{background:#e8e6ff}
.feature-desc{font-size:11px;color:var(--text-secondary);line-height:1.5;padding:0 16px 14px}

.recents-section{background:var(--primary-bg);border:1px solid var(--border-color);border-radius:12px;padding:20px}
.recents-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.recents-header h2{font-size:16px;font-weight:600}
.recents-view-toggle{display:flex;gap:2px}
.recents-view-toggle button{padding:5px 8px;border:1px solid var(--border-color);background:var(--primary-bg);cursor:pointer;display:flex;align-items:center;border-radius:4px}
.recents-view-toggle button.active{background:#e8e8e8}

.type-badge{display:inline-flex;align-items:center;gap:4px;padding:2px 10px;border-radius:4px;font-size:11px;font-weight:500}
.type-badge.agent{background:#e8e6ff;color:#4200DB}
.type-badge.flow{background:#e8f5e9;color:#27700E}
.type-badge.dashboard{background:#e3f2fd;color:#1565C0}
.type-badge.analysis{background:#fff3e0;color:#E65100}

/* ===== Chat Panel - "Let's dive in" style ===== */
.chat-welcome{display:flex;flex-direction:column;padding:0 4px;height:100%}
.chat-welcome-spacer{flex:1;min-height:60px}
.chat-dive-in{font-size:22px;font-weight:300;color:var(--text-primary);margin-bottom:16px;letter-spacing:.3px}
.chat-input-card{background:linear-gradient(180deg,#f3f0ff 0%,#faf8ff 100%);border:1px solid #e0d8ff;border-radius:12px;overflow:hidden;margin:0 auto 16px;width:90%}
.chat-input-card-header{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-bottom:1px solid #e8e6ff}
.chat-assistant-label{font-size:11px;font-weight:600;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.5px;display:flex;align-items:center;gap:4px;cursor:pointer}
.chat-add-btn{background:none;border:none;cursor:pointer;display:flex;align-items:center}
.chat-input-inner{padding:12px 14px}
.chat-input-inner textarea{width:100%;border:none;background:none;font-family:var(--font-family);font-size:13px;resize:none;outline:none;color:var(--text-primary);min-height:40px}
.chat-input-inner textarea::placeholder{color:#8c8c94}
.chat-input-tools{display:flex;align-items:center;justify-content:space-between;margin-top:8px}
.chat-scope{font-size:11px;color:var(--text-secondary);border:1px solid var(--border-color);border-radius:14px;padding:3px 10px;display:flex;align-items:center;gap:4px;cursor:pointer}
.chat-tool-icons{display:flex;align-items:center;gap:8px}
.chat-send-icon{cursor:pointer}
.chat-suggestions{display:flex;flex-direction:column;gap:8px;margin:0 auto 16px;width:90%}
.chat-suggest-btn{display:flex;align-items:center;gap:8px;background:var(--primary-bg);border:1px solid var(--border-color);border-radius:8px;padding:8px 14px;font-size:12px;color:var(--text-primary);cursor:pointer;font-family:var(--font-family);text-align:left;transition:background .15s}
.chat-suggest-btn:hover{background:#f3f3f7}
.chat-view-more{display:flex;align-items:center;gap:6px;background:none;border:none;color:var(--text-muted);font-size:12px;cursor:pointer;font-family:var(--font-family);padding:4px 0}
.chat-view-more:hover{color:var(--text-secondary)}
.chat-footer-policy{font-size:10px;color:var(--text-muted);text-align:center;padding:12px 0;margin-top:auto}
.chat-footer-policy a{color:var(--text-secondary);text-decoration:underline}

/* Chat panel header - Expand style */
.chat-panel-header .chat-panel-title span{font-size:12px;font-weight:400;color:var(--text-primary)}


/* Add dialog tabs */
.adt{padding:8px 12px;font-size:11px;border:none;background:none;cursor:pointer;border-bottom:2px solid transparent;color:#8c8c94;font-family:inherit;white-space:nowrap}
.adt:hover{color:#16191f}
.adt.active{border-bottom-color:#4200DB;color:#4200DB;font-weight:500}


/* Integration tabs */
.int-tab{padding:6px 14px;font-size:13px;border:1px solid transparent;background:none;cursor:pointer;border-radius:8px;color:#8c8c94;font-family:inherit;font-weight:400}
.int-tab:hover{color:#16191f}
.int-tab.active{background:#f0f0f5;border-color:#dedee3;color:#16191f;font-weight:600}

/* Three-dot menu */
.dot-menu-btn{background:none;border:none;cursor:pointer;color:#8c8c94;font-size:16px;padding:4px 6px;border-radius:4px;line-height:1}
.dot-menu-btn:hover,.dot-menu-btn.open{background:#262626;color:white;border-radius:6px}
.dot-menu{position:absolute;right:0;top:100%;background:white;border:1px solid #dedee3;border-radius:8px;box-shadow:0 4px 16px rgba(0,0,0,.12);z-index:9999;min-width:120px;padding:6px 0;display:none}
.dot-menu.show{display:block}
.dot-menu.show-up{top:auto;bottom:100%}
.dot-menu-item{padding:8px 16px;font-size:13px;color:#16191f;cursor:pointer;display:block;width:100%;text-align:left;background:none;border:none;font-family:inherit}
.dot-menu-item:hover{background:#f3f3f7}

/* Action card + button no border */
.action-card .add-btn{border:none !important;background:none !important}
.action-card .add-btn:hover{background:none !important;color:#4200DB}


/* Flow tabs */
.flow-tab{padding:6px 14px;font-size:13px;border:none;background:none;cursor:pointer;border-radius:8px;color:#8c8c94;font-family:inherit;font-weight:400}
.flow-tab:hover{color:#16191f}
.flow-tab.active{background:#f0f0f5;color:#16191f;font-weight:500}
.flow-tab .badge{display:inline-flex;align-items:center;justify-content:center;background:#2196F3;color:#fff;font-size:10px;min-width:16px;height:16px;border-radius:50%;margin-left:4px;padding:0 4px}


/* ===== Integration Wizard Modal ===== */
.wizard-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.4);z-index:9999;display:flex;align-items:center;justify-content:center}
.wizard-modal{background:#fff;border-radius:12px;width:900px;max-height:90vh;display:flex;flex-direction:column;box-shadow:0 8px 32px rgba(0,0,0,.2)}
.wizard-header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;border-bottom:1px solid #e5e7eb}
.wizard-header-left{display:flex;align-items:center;gap:8px}
.wizard-header-left svg{color:#6b7280}
.wizard-header h2{font-size:18px;font-weight:600;color:#1a1a2e;margin:0}
.wizard-close{background:none;border:none;cursor:pointer;color:#9ca3af;font-size:22px;padding:4px 8px;border-radius:4px;line-height:1}
.wizard-close:hover{background:#f3f4f6;color:#6b7280}
.wizard-body{display:flex;flex:1;overflow:hidden;min-height:480px}
.wizard-sidebar{width:220px;padding:32px 24px;border-right:1px solid #e5e7eb;flex-shrink:0}
.wizard-steps{display:flex;flex-direction:column;gap:24px}
.wizard-step{display:flex;align-items:center;gap:12px;font-size:13px;color:#9ca3af;font-weight:400}
.wizard-step.active{color:#1a1a2e;font-weight:600}
.wizard-step.completed{color:#1a1a2e;font-weight:400}
.wizard-step-circle{width:14px;height:14px;border-radius:50%;border:2px solid #d1d5db;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:8px}
.wizard-step.active .wizard-step-circle{background:#5B4FE8;border-color:#5B4FE8}
.wizard-step.completed .wizard-step-circle{background:#5B4FE8;border-color:#5B4FE8}
.wizard-step.completed .wizard-step-circle::after{content:'\2713';color:#fff;font-size:8px;font-weight:700}
.wizard-step.active .wizard-step-circle::after{content:'';width:4px;height:4px;background:#fff;border-radius:50%}
.wizard-content{flex:1;padding:32px;overflow-y:auto}
.wizard-content h3{font-size:16px;font-weight:600;color:#1a1a2e;margin-bottom:8px}
.wizard-content .wizard-subtitle{font-size:13px;color:#6b7280;margin-bottom:24px;line-height:1.5}
.wizard-content .wizard-subtitle a{color:#2563eb;text-decoration:underline}
.wizard-field{margin-bottom:20px}
.wizard-field label{display:block;font-size:12px;font-weight:600;color:#1a1a2e;margin-bottom:6px}
.wizard-field label .info-icon{display:inline-flex;align-items:center;margin-left:4px;cursor:help;color:#9ca3af}
.wizard-field input[type="text"],.wizard-field input[type="password"],.wizard-field input[type="email"],.wizard-field textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:13px;font-family:inherit;color:#1a1a2e;outline:none;background:#fff}
.wizard-field input[type="text"]:focus,.wizard-field input[type="password"]:focus,.wizard-field input[type="email"]:focus,.wizard-field textarea:focus{border-color:#5B4FE8;box-shadow:0 0 0 2px rgba(91,79,232,.12)}
.wizard-field input::placeholder,.wizard-field textarea::placeholder{color:#9ca3af}
.wizard-field textarea{resize:vertical;min-height:100px}
.wizard-field .field-help{font-size:11px;color:#9ca3af;margin-top:4px;line-height:1.4}
.wizard-autopublish{margin-top:24px}
.wizard-autopublish h4{font-size:13px;font-weight:600;color:#1a1a2e;margin-bottom:6px}
.wizard-autopublish p{font-size:12px;color:#6b7280;line-height:1.5;margin-bottom:10px}
.wizard-checkbox{display:flex;align-items:center;gap:8px;font-size:13px;color:#1a1a2e;cursor:pointer}
.wizard-checkbox input[type="checkbox"]{width:16px;height:16px;accent-color:#5B4FE8;cursor:pointer}
.wizard-footer{display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:16px 24px;border-top:1px solid #e5e7eb}
.wizard-btn-cancel{background:none;border:none;cursor:pointer;font-size:13px;color:#4b5563;font-family:inherit;padding:8px 16px;border-radius:6px}
.wizard-btn-cancel:hover{background:#f3f4f6}
.wizard-btn-back{background:none;border:1px solid #d1d5db;cursor:pointer;font-size:13px;color:#4b5563;font-family:inherit;padding:8px 16px;border-radius:6px}
.wizard-btn-back:hover{background:#f3f4f6}
.wizard-btn-next{background:#5B4FE8;color:#fff;border:none;cursor:pointer;font-size:13px;font-family:inherit;padding:8px 20px;border-radius:6px;font-weight:500}
.wizard-btn-next:hover{background:#4a3ed4}
.wizard-btn-next:disabled{opacity:.5;cursor:not-allowed}

/* Wizard auth step */
.wizard-auth-info{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px;display:flex;align-items:flex-start;gap:10px;margin-bottom:20px}
.wizard-auth-info svg{flex-shrink:0;color:#16a34a;margin-top:2px}
.wizard-auth-info p{font-size:13px;color:#166534;line-height:1.5}

/* Wizard review step */
.wizard-review-row{display:flex;padding:12px 0;border-bottom:1px solid #f0f0f0}
.wizard-review-row:last-child{border-bottom:none}
.wizard-review-label{width:160px;font-size:12px;font-weight:600;color:#6b7280;flex-shrink:0}
.wizard-review-value{font-size:13px;color:#1a1a2e;flex:1;word-break:break-all}

/* Wizard share step */
.wizard-share-success{text-align:center;padding:40px 20px}
.wizard-share-success svg{margin-bottom:16px}
.wizard-share-success h3{font-size:18px;font-weight:600;color:#1a1a2e;margin-bottom:8px}
.wizard-share-success p{font-size:13px;color:#6b7280;line-height:1.5;max-width:400px;margin:0 auto}


/* ===== Redesigned Chat Panel ===== */
.chat-panel-header-new {
    background: #1a1a1a; height: 48px; display: flex; align-items: center;
    justify-content: space-between; padding: 0 12px; flex-shrink: 0;
    width: 100%; box-sizing: border-box;
}
.chat-panel-header-new .chat-hdr-center {
    display: flex; align-items: center; gap: 6px; color: #fff; font-size: 12px;
    font-weight: 400; cursor: pointer;
}
.chat-panel-header-new .chat-hdr-right {
    display: flex; align-items: center; gap: 8px;
}
.chat-panel-header-new .chat-hdr-right button {
    background: none; border: none; color: #fff; cursor: pointer;
    display: flex; align-items: center; padding: 4px;
}

/* Chat messages redesigned */
.chat-msg-user {
    display: flex; justify-content: flex-end; margin: 12px 14px;
}
.chat-msg-user .chat-bubble {
    background: #e8e0ff; color: #1a1a2e; border-radius: 18px;
    padding: 10px 16px; max-width: 85%; font-size: 13px; line-height: 1.5;
}
.chat-msg-assistant {
    margin: 12px 14px;
}
.chat-msg-assistant .chat-ast-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.chat-msg-assistant .chat-ast-label {
    display: flex; align-items: center; gap: 6px; font-size: 10px;
    font-weight: 600; color: #8c8c94; text-transform: uppercase; letter-spacing: 0.5px;
}
.chat-msg-assistant .chat-ast-label .sparkle-icon { display: flex; }
.chat-msg-assistant .chat-ast-events {
    font-size: 11px; color: #8c8c94; cursor: pointer; display: flex; align-items: center; gap: 3px;
}
.chat-msg-assistant .chat-ast-body {
    font-size: 13px; color: #1a1a2e; line-height: 1.6; padding-left: 22px;
}
.chat-msg-assistant .chat-ast-body pre {
    background: #f5f5f5; border-radius: 6px; padding: 10px; overflow-x: auto;
    font-size: 12px; margin: 8px 0;
}
.chat-msg-assistant .chat-ast-body code {
    background: #f0f0f5; padding: 1px 4px; border-radius: 3px; font-size: 12px;
}

/* Chat footer redesigned */
.chat-footer-new {
    border-top: 1px solid #e8e8e8; padding: 10px 12px 8px; flex-shrink: 0;
    background: #fff; overflow: visible; position: relative;
}
.chat-agent-selector {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.chat-agent-pill {
    display: flex; align-items: center; gap: 6px; background: #f0ecff;
    border: none; border-radius: 16px; padding: 5px 12px; font-size: 12px;
    color: #1a1a2e; cursor: pointer; font-family: inherit; font-weight: 500;
}
.chat-agent-pill:hover { background: #e4dcff; }
.chat-agent-add-btn {
    background: none; border: none; cursor: pointer; display: flex;
    align-items: center; color: #6842FF;
}
.chat-input-new {
    border: 1px solid #dedee3; border-radius: 20px; padding: 8px 14px;
    display: flex; align-items: center; margin-bottom: 6px; background: #fff;
}
.chat-input-new input {
    flex: 1; border: none; outline: none; font-size: 13px; font-family: inherit;
    color: #1a1a2e; background: none;
}
.chat-input-new input::placeholder { color: #8c8c94; }
.chat-toolbar-new {
    display: flex; align-items: center; gap: 6px;
}
.chat-toolbar-new .scope-pill {
    font-size: 11px; color: #545b64; border: 1px solid #dedee3; border-radius: 14px;
    padding: 2px 10px; cursor: pointer; display: flex; align-items: center; gap: 3px;
    background: none; font-family: inherit;
}
.scope-dropdown-panel {
    display: none; position: absolute; bottom: 100%; left: 0; background: #fff;
    border: 1px solid #dedee3; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.12);
    z-index: 9999; min-width: 320px; padding: 8px 0; margin-bottom: 6px;
}
.scope-dropdown-panel.show { display: block; }
.scope-option {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; cursor: pointer;
    transition: background .1s;
}
.scope-option:hover { background: #f3f3f7; }
.scope-option.active { background: #f3f3f7; }
.chat-toolbar-new .tool-icons {
    display: flex; align-items: center; gap: 6px; margin-left: 4px;
}
.chat-toolbar-new .tool-icons svg { cursor: pointer; }
.chat-toolbar-new .send-arrow {
    margin-left: auto; cursor: pointer; display: flex; align-items: center;
    background: none; border: none; padding: 2px;
}
.chat-footer-policy-new {
    font-size: 9px; color: #8c8c94; text-align: center; padding: 4px 0 0;
}
.chat-footer-policy-new a { color: #545b64; text-decoration: underline; }

/* Agent dropdown */
.agent-dropdown {
    position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 4px;
    background: #fff; border: 1px solid #dedee3; border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.15); z-index: 300;
    max-height: 340px; display: flex; flex-direction: column; overflow: hidden;
}
.agent-dropdown .ad-search {
    padding: 10px 12px; border-bottom: 1px solid #f0f0f0;
}
.agent-dropdown .ad-search input {
    width: 100%; border: 1px solid #dedee3; border-radius: 6px; padding: 6px 10px;
    font-size: 12px; font-family: inherit; outline: none;
}
.agent-dropdown .ad-search input:focus { border-color: #6842FF; }
.agent-dropdown .ad-tabs {
    display: flex; gap: 0; border-bottom: 1px solid #f0f0f0; padding: 0 12px;
}
.agent-dropdown .ad-tab {
    padding: 8px 10px; font-size: 11px; border: none; background: none;
    cursor: pointer; color: #8c8c94; font-family: inherit; border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.agent-dropdown .ad-tab.active { color: #4200DB; border-bottom-color: #4200DB; font-weight: 500; }
.agent-dropdown .ad-list {
    flex: 1; overflow-y: auto; padding: 4px 0;
}
.agent-dropdown .ad-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    cursor: pointer; font-size: 12px; color: #1a1a2e;
}
.agent-dropdown .ad-row:hover { background: #f3f3f7; }
.agent-dropdown .ad-row .ad-name { flex: 1; font-weight: 500; }
.agent-dropdown .ad-row .ad-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 4px;
    background: #e8e6ff; color: #4200DB;
}
.agent-dropdown .ad-row .ad-star {
    color: #d4d4d4; cursor: pointer; font-size: 14px;
}
.agent-dropdown .ad-row .ad-star.filled { color: #f59e0b; }
.agent-dropdown .ad-footer {
    padding: 8px 12px; border-top: 1px solid #f0f0f0; font-size: 11px;
}
.agent-dropdown .ad-footer a { color: #4200DB; text-decoration: none; }
.agent-dropdown .ad-footer a:hover { text-decoration: underline; }

/* ===== Agent Creation Page ===== */
/* Step 1 - Prompt page */
.agent-prompt-page {
    display: flex; flex-direction: column; align-items: center;
    padding: 40px 20px; max-width: 720px; margin: 0 auto;
}
.agent-prompt-page .sparkle-large {
    width: 64px; height: 64px; margin-bottom: 20px;
}
.agent-prompt-page .title-gradient {
    font-size: 22px; font-weight: 600; text-align: center; margin-bottom: 8px;
    background: linear-gradient(135deg, #FF4B14, #D600BA, #78008A, #6842FF);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.agent-prompt-page .subtitle {
    font-size: 14px; color: #6b7280; text-align: center; margin-bottom: 24px;
}
.agent-prompt-area {
    width: 100%; position: relative; margin-bottom: 16px;
}
.agent-prompt-area textarea {
    width: 100%; min-height: 120px; border: 1px solid #dedee3; border-radius: 10px;
    padding: 14px; font-size: 14px; font-family: inherit; resize: vertical;
    outline: none; color: #1a1a2e;
}
.agent-prompt-area textarea:focus { border-color: #6842FF; }
.agent-prompt-area .prompt-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 6px;
}
.agent-prompt-area .prompt-footer .clear-link {
    color: #4200DB; font-size: 12px; cursor: pointer; background: none;
    border: none; font-family: inherit;
}
.agent-prompt-area .prompt-footer .char-count {
    font-size: 12px; color: #8c8c94;
}
.agent-prompt-btns {
    display: flex; gap: 10px; margin-bottom: 32px;
}
.agent-prompt-btns .btn-skip {
    padding: 8px 24px; border: 1px solid #dedee3; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: 13px; font-family: inherit;
}
.agent-prompt-btns .btn-skip:hover { background: #f3f3f7; }
.agent-prompt-btns .btn-generate {
    padding: 8px 24px; border: none; border-radius: 6px;
    background: #5B4FE8; color: #fff; cursor: pointer; font-size: 13px;
    font-family: inherit; font-weight: 500;
}
.agent-prompt-btns .btn-generate:hover { background: #4a3ed4; }
.agent-prompt-btns .btn-generate:disabled { opacity: .5; cursor: not-allowed; }
.agent-templates {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%;
}
.agent-template-card {
    border: 1px solid #dedee3; border-radius: 10px; padding: 16px;
    cursor: pointer; transition: all .15s; background: #fff;
}
.agent-template-card:hover { border-color: #6842FF; box-shadow: 0 2px 8px rgba(104,66,255,.1); }
.agent-template-card h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.agent-template-card p { font-size: 11px; color: #6b7280; line-height: 1.4; }

/* Step 2 - Agent detail page */
.agent-detail-page {
    display: flex; gap: 0; height: calc(100vh - 100px); overflow: hidden;
}
.agent-detail-left {
    flex: 1; overflow-y: auto; padding: 24px 28px; border-right: 1px solid #e8e8e8;
}
.agent-detail-right {
    width: 280px; flex-shrink: 0; display: flex; flex-direction: column;
    background: #fafafa; overflow-y: auto;
}
.agent-detail-topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; border-bottom: 1px solid #e8e8e8; background: #fff;
}
.agent-detail-topbar .breadcrumb {
    font-size: 13px; color: #8c8c94;
}
.agent-detail-topbar .breadcrumb a { color: #4200DB; text-decoration: none; }
.agent-detail-topbar .topbar-actions { display: flex; gap: 8px; }
.agent-detail-topbar .btn-share {
    padding: 6px 16px; border: 1px solid #dedee3; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: 12px; font-family: inherit;
}
.agent-detail-topbar .btn-launch {
    padding: 6px 16px; border: none; border-radius: 6px;
    background: #5B4FE8; color: #fff; cursor: pointer; font-size: 12px;
    font-family: inherit; font-weight: 500;
}
.agent-detail-topbar .btn-launch:hover { background: #4a3ed4; }

.agent-name-input {
    font-size: 22px; font-weight: 300; border: none; outline: none;
    width: 100%; color: #1a1a2e; font-family: inherit; margin-bottom: 4px;
    background: transparent; padding: 0;
}
.agent-name-input:focus { border-bottom: 1px solid #6842FF; }
.agent-desc-input {
    font-size: 13px; border: none; outline: none; width: 100%;
    color: #6b7280; font-family: inherit; margin-bottom: 20px;
    background: transparent; padding: 0;
}
.agent-desc-input:focus { border-bottom: 1px solid #6842FF; }

.agent-config-card {
    border: 1px solid #e8e8e8; border-radius: 10px; background: #fff;
    margin-bottom: 16px;
}
.agent-config-card .config-header {
    padding: 16px 20px; font-size: 14px; font-weight: 600;
}
.agent-config-card .info-banner {
    margin: 0 20px 16px; padding: 10px 14px; background: #f0f7ff;
    border: 1px solid #bfdbfe; border-radius: 8px; font-size: 12px;
    color: #1e40af; display: flex; align-items: center; gap: 8px;
}
.agent-collapsible {
    border-top: 1px solid #f0f0f0;
}
.agent-collapsible-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; cursor: pointer; font-size: 12px; font-weight: 600;
    color: #1a1a2e; text-transform: uppercase; letter-spacing: 0.5px;
}
.agent-collapsible-header:hover { background: #fafafa; }
.agent-collapsible-body {
    padding: 0 20px 16px;
}
.agent-instructions-textarea {
    width: 100%; min-height: 160px; border: 1px solid #dedee3; border-radius: 8px;
    padding: 12px; font-size: 13px; font-family: inherit; resize: vertical;
    outline: none; color: #1a1a2e;
}
.agent-instructions-textarea:focus { border-color: #6842FF; }
.agent-refine-btn {
    display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
    background: none; border: 1px solid #dedee3; border-radius: 6px;
    padding: 5px 12px; font-size: 12px; color: #6842FF; cursor: pointer;
    font-family: inherit;
}
.agent-refine-btn:hover { background: #f3f0ff; }
.agent-upload-zone {
    border: 2px dashed #dedee3; border-radius: 8px; padding: 20px;
    text-align: center; color: #8c8c94; font-size: 12px; cursor: pointer;
}
.agent-upload-zone:hover { border-color: #6842FF; background: #faf8ff; }
.agent-section-actions {
    display: flex; gap: 8px; margin-top: 8px;
}
.agent-section-actions button {
    padding: 5px 12px; border: 1px solid #dedee3; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: 12px; font-family: inherit;
}
.agent-section-actions button:hover { background: #f3f3f7; }

/* Preview panel */
.agent-preview {
    padding: 20px; display: flex; flex-direction: column; height: 100%;
}
.agent-preview .preview-label {
    font-size: 10px; font-weight: 600; color: #8c8c94; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 12px;
}
.agent-preview .preview-name {
    font-size: 16px; font-weight: 600; margin-bottom: 4px; color: #1a1a2e;
}
.agent-preview .preview-desc {
    font-size: 12px; color: #6b7280; margin-bottom: 20px; line-height: 1.4;
}
.agent-preview .preview-chat-input {
    border: 1px solid #dedee3; border-radius: 20px; padding: 8px 14px;
    font-size: 12px; color: #8c8c94; margin-bottom: 12px; background: #fff;
}
.agent-preview .preview-prompts {
    display: flex; flex-direction: column; gap: 6px;
}
.agent-preview .preview-prompt-btn {
    border: 1px solid #dedee3; border-radius: 16px; padding: 6px 12px;
    font-size: 11px; color: #1a1a2e; background: #fff; cursor: pointer;
    text-align: left; font-family: inherit;
}
.agent-preview .preview-prompt-btn:hover { background: #f3f3f7; }


/* ===== Link Actions Dialog ===== */
.link-actions-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.link-actions-modal {
    background: #fff; border-radius: 12px; width: 100%; max-width: 960px;
    max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.link-actions-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid #e5e7eb;
}
.link-actions-header h2 {
    font-size: 18px; font-weight: 600; color: #1a1a2e; margin: 0;
}
.link-actions-close {
    background: none; border: none; cursor: pointer; color: #9ca3af;
    font-size: 22px; padding: 4px 8px; border-radius: 4px; line-height: 1;
}
.link-actions-close:hover { background: #f3f4f6; color: #6b7280; }
.link-actions-search {
    padding: 12px 24px; border-bottom: 1px solid #f0f0f0;
}
.link-actions-search input {
    width: 100%; border: 1px solid #dedee3; border-radius: 6px;
    padding: 8px 12px; font-size: 13px; font-family: inherit; outline: none;
}
.link-actions-search input:focus { border-color: #6842FF; }
.link-actions-table-wrap {
    flex: 1; overflow-y: auto; padding: 0 24px;
}
.link-actions-table-wrap .data-table { border: none; }
.link-actions-table-wrap .data-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.link-actions-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 12px; padding: 16px 24px; border-top: 1px solid #e5e7eb;
}
.link-actions-cancel {
    background: none; border: 1px solid #d1d5db; cursor: pointer;
    font-size: 13px; color: #4b5563; font-family: inherit;
    padding: 8px 20px; border-radius: 6px;
}
.link-actions-cancel:hover { background: #f3f4f6; }
.link-actions-submit {
    background: #5B4FE8; color: #fff; border: none; cursor: pointer;
    font-size: 13px; font-family: inherit; padding: 8px 24px;
    border-radius: 6px; font-weight: 500;
}
.link-actions-submit:hover { background: #4a3ed4; }

/* ===== Linked Actions Cards ===== */
.linked-actions-list {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
}
.linked-action-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border: 1px solid #e8e8e8; border-radius: 8px;
    background: #fff;
}
.linked-action-info {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    color: #1a1a2e; font-weight: 500;
}
.linked-action-status {
    font-size: 11px; color: #27700E; background: #f0fdf4;
    padding: 2px 8px; border-radius: 10px; font-weight: 400;
}
.linked-action-remove {
    background: none; border: none; cursor: pointer; color: #9ca3af;
    font-size: 18px; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.linked-action-remove:hover { background: #fee2e2; color: #dc2626; }

/* ===== Preview Panel - Chat Area ===== */
.preview-chat-area {
    flex: 1; display: flex; flex-direction: column; margin-bottom: 12px;
    min-height: 0; overflow: hidden;
}
.preview-messages {
    flex: 1; overflow-y: auto; margin-bottom: 8px; max-height: 300px;
}
.preview-msg-user {
    display: flex; justify-content: flex-end; margin-bottom: 8px;
}
.preview-msg-user .preview-bubble {
    background: #e8e0ff; color: #1a1a2e; border-radius: 14px;
    padding: 6px 12px; max-width: 85%; font-size: 12px; line-height: 1.4;
    display: flex; align-items: center; gap: 4px;
}
.preview-msg-assistant {
    margin-bottom: 8px;
}
.preview-ast-body {
    font-size: 12px; color: #1a1a2e; line-height: 1.5; padding: 6px 0;
}
.preview-typing {
    display: flex; gap: 4px; padding: 8px 0;
}
.preview-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: #8c8c94;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.preview-typing span:nth-child(1) { animation-delay: -0.32s; }
.preview-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.preview-chat-input-wrap {
    border: 1px solid #dedee3; border-radius: 12px; padding: 8px 12px;
    background: #fff;
}
.preview-chat-input-field {
    width: 100%; border: none; outline: none; font-size: 12px;
    font-family: inherit; color: #1a1a2e; background: none; padding: 2px 0;
}
.preview-chat-input-field::placeholder { color: #8c8c94; }
.preview-chat-footer-tools {
    display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.preview-tool-icon {
    cursor: pointer; flex-shrink: 0;
}

/* ===== Web Search Steps ===== */
.web-search-steps {
    display: flex; flex-direction: column; gap: 6px; padding: 8px 0 4px;
}
.ws-step {
    display: flex; align-items: center; gap: 6px; font-size: 12px;
    color: #6b7280; padding: 4px 8px; border-radius: 6px;
    background: none; border: none;
}
.ws-step.active {
    color: #1a1a2e; background: none; border: none;
}
.ws-step.active svg circle { animation: wsPulse 1.2s infinite; }
@keyframes wsPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.ws-step.done {
    color: #27700E; background: none; border: none;
}


/* ===== Rich Text Editor ===== */
.rte-container {
    border: 1px solid #dedee3; border-radius: 8px; overflow: hidden; background: #fff;
}
.rte-toolbar {
    display: flex; align-items: center; gap: 2px; padding: 6px 10px;
    border-bottom: 1px solid #e8e8e8; background: #fff; flex-wrap: wrap;
}
.rte-btn {
    background: none; border: none; cursor: pointer; padding: 4px 7px;
    font-size: 13px; color: #1a1a2e; border-radius: 4px; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 28px; line-height: 1;
}
.rte-btn:hover { background: #f3f3f7; }
.rte-btn:active { background: #e8e8e8; }
.rte-btn sub { font-size: 9px; }
.rte-sep {
    width: 1px; height: 20px; background: #dedee3; margin: 0 4px;
}
.rte-editor {
    padding: 14px; font-size: 13px; color: #1a1a2e; line-height: 1.6;
    outline: none; font-family: inherit; overflow-y: auto; max-height: 300px;
}
.rte-editor:empty::before {
    content: 'Enter instructions for your agent persona...';
    color: #8c8c94;
}
.rte-editor:focus { box-shadow: inset 0 0 0 1px #6842FF; }
.rte-editor h1 { font-size: 20px; font-weight: 600; margin: 8px 0; }
.rte-editor h2 { font-size: 17px; font-weight: 600; margin: 6px 0; }
.rte-editor h3 { font-size: 15px; font-weight: 600; margin: 4px 0; }
.rte-editor ul, .rte-editor ol { padding-left: 20px; margin: 6px 0; }
.rte-editor blockquote {
    border-left: 3px solid #dedee3; padding-left: 12px; margin: 6px 0;
    color: #6b7280; font-style: italic;
}
.rte-editor pre {
    background: #f5f5f5; padding: 10px; border-radius: 6px;
    font-family: monospace; font-size: 12px; overflow-x: auto; margin: 6px 0;
}


/* ===== Tool Use Indicator ===== */
.tool-use-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f3f0ff; border: 1px solid #e0d8ff; border-radius: 20px;
    padding: 4px 12px; font-size: 11px; color: #5B4FE8; font-weight: 500;
    margin: 6px 0;
}
.tool-use-badge svg { flex-shrink: 0; }
.tool-use-badge.done { background: #f0fdf4; border-color: #bbf7d0; color: #16a34a; }


/* ===== Markdown Table ===== */
.md-table {
    width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12px;
}
.md-table th {
    text-align: left; padding: 8px 12px; font-weight: 600; color: #1a1a2e;
    border-bottom: 2px solid #dedee3; background: #f9fafb;
}
.md-table td {
    padding: 6px 12px; border-bottom: 1px solid #f0f0f0; color: #4b5563;
}
.md-table tr:hover td { background: #f9fafb; }


/* ===== Step List (Tool Use Steps) ===== */
.step-list {
    padding: 8px 0 8px 22px; margin-bottom: 8px;
    border-left: 2px solid #e8e8e8; margin-left: 6px;
}
.step-item {
    display: flex; align-items: center; gap: 8px; padding: 4px 0;
    font-size: 12px; color: #1a1a2e; position: relative;
}
.step-item .step-connector {
    position: absolute; left: -16px; top: 0; bottom: 0; width: 2px;
}
.step-item svg { flex-shrink: 0; }
.step-item .step-text { font-weight: 500; }
.step-text-item .step-text { font-weight: 400; font-size: 11px; }
