/* ===================================
   Canvas Mode v5 - Complete Styles
   =================================== */

/* Canvas Toggle Button */
.btn-canvas-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-canvas-toggle:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.btn-canvas-toggle.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    border-color: rgba(99, 102, 241, 0.5);
    color: #c4b5fd;
}

/* Canvas Container - leave space for chat sidebar */
.canvas-container {
    position: absolute;
    inset: 0;
    right: 400px;
    /* Leave space for permanent chat sidebar */
    overflow: auto;
    background:
        radial-gradient(circle at 20px 20px, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    background-color: #0a0a12;
}

/* ===================================
   Custom Modal
   =================================== */
.canvas-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.canvas-modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    background: #16161e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.canvas-modal.open .modal-dialog {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #f0f0f0;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    color: #bbb;
    margin: 0 0 12px;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.modal-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Modal Form Fields */
.modal-field-group {
    margin-bottom: 18px;
}

.modal-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #999;
    margin-bottom: 8px;
}

.modal-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #f0f0f0;
    font-size: 14px;
    transition: all 0.15s;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

.modal-input::placeholder {
    color: #555;
}

select.modal-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.modal-input {
    min-height: 80px;
    line-height: 1.5;
}

/* Agent Picker */
.agent-pick-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.agent-pick-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.agent-pick-item:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateX(4px);
}

.agent-pick-icon {
    font-size: 24px;
}

.agent-pick-info {
    flex: 1;
}

.agent-pick-name {
    font-size: 14px;
    font-weight: 500;
    color: #f0f0f0;
}

.agent-pick-type {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* ===================================
   Navigation Bar
   =================================== */
.canvas-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: #12121a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    color: #fff;
}

.nav-icon {
    font-size: 18px;
}

.nav-label {
    font-weight: 500;
}

/* View Content */
.view-content {
    position: absolute;
    inset: 60px 20px 80px 20px;
    display: none;
}

.view-header {
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #f0f0f0;
    margin: 0 0 8px;
}

.view-header p {
    color: #888;
    font-size: 14px;
    margin: 0;
}

.view-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #666;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===================================
   SVG Connections
   =================================== */
.canvas-connections {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    fill: none;
    stroke: #6366f1;
    stroke-width: 3;
    stroke-linecap: round;
    pointer-events: visibleStroke;
    cursor: pointer;
    transition: all 0.2s;
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
}

.connection-line:hover {
    stroke-width: 5 !important;
    stroke: #818cf8;
    filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.6));
}

.connection-line.selected {
    stroke: #ef4444 !important;
    stroke-width: 4 !important;
    stroke-dasharray: none !important;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
    animation: none;
}

.connection-delete-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 100;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.15s;
}

.connection-delete-btn:hover {
    transform: translate(-50%, -50%) scale(1.15);
    background: #dc2626;
}

.connection-line.temp {
    stroke: #a78bfa;
    stroke-width: 3;
    stroke-dasharray: 8, 6;
    opacity: 0.9;
    filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.6));
}

/* ===================================
   Nodes
   =================================== */
.canvas-node {
    position: absolute;
    background: #1a1a2a;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 16px 20px;
    cursor: grab;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 14px;
    user-select: none;
    min-width: 180px;
    transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}

.canvas-node:hover {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.2);
}

.canvas-node.dragging {
    cursor: grabbing;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.3);
    transform: scale(1.03);
    z-index: 100;
}

.canvas-node.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3), 0 8px 32px rgba(99, 102, 241, 0.25);
}

/* Node Handles */
.node-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #2a2a40;
    border: 3px solid #6366f1;
    border-radius: 50%;
    cursor: crosshair;
    transition: all 0.15s;
    z-index: 15;
}

.node-handle:hover {
    background: #6366f1;
    transform: scale(1.4);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.7);
}

.node-handle.connecting {
    background: #6366f1;
    transform: scale(1.5);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.8);
}

.node-handle.input {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.node-handle.output {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.node-handle.input:hover,
.node-handle.output:hover {
    transform: translateY(-50%) scale(1.4);
}

/* Node Elements */
.node-icon {
    font-size: 28px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    border-radius: 10px;
    flex-shrink: 0;
}

.node-info {
    flex: 1;
    min-width: 0;
}

.node-label {
    font-size: 15px;
    font-weight: 600;
    color: #f0f0f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-sublabel {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Project Node */
.project-node {
    background: linear-gradient(135deg, #1a1a2a, #1e1e32);
    border-color: rgba(99, 102, 241, 0.4);
    padding: 20px 24px;
    min-width: 240px;
}

.project-node .node-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
}

.project-node .node-label {
    font-size: 18px;
}

/* Agent Node */
.agent-node {
    background: linear-gradient(135deg, #1a1f2a, #161e28);
    border-color: rgba(52, 211, 153, 0.4);
}

.agent-node .node-icon {
    background: rgba(52, 211, 153, 0.18);
}

.agent-node .node-handle {
    border-color: #34d399;
}

.node-type-badge {
    font-size: 11px;
    color: #34d399;
    background: rgba(52, 211, 153, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 5px;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 500;
}

/* Task Node */
.task-node {
    background: var(--horizon-bg, #1a1a2a);
    border-color: var(--horizon-border, rgba(255, 255, 255, 0.12));
    padding: 14px 18px;
    min-width: 200px;
}

.task-node:hover {
    border-color: var(--horizon-border, #6366f1);
}

.horizon-indicator {
    width: 6px;
    height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
}

.node-checkbox {
    width: 24px;
    height: 24px;
    border: 3px solid #4ade80;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-checkbox:hover {
    background: rgba(74, 222, 128, 0.25);
}

.node-checkbox.checked {
    background: #4ade80;
}

.node-checkbox.checked::after {
    content: '✓';
    color: #0d0d14;
    font-size: 14px;
    font-weight: bold;
}

.task-node.completed {
    opacity: 0.5;
}

.task-node.completed .node-label {
    text-decoration: line-through;
    color: #666;
}

/* Orchestrator Node */
.orchestrator-node {
    background: linear-gradient(135deg, #1f1a2a, #261a32);
    border-color: rgba(139, 92, 246, 0.5);
}

.orchestrator-node .node-icon {
    background: rgba(139, 92, 246, 0.2);
}

.orchestrator-node .node-handle {
    border-color: #8b5cf6;
}

.node-schedule {
    font-size: 11px;
    color: #8b5cf6;
    text-transform: uppercase;
    background: rgba(139, 92, 246, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 5px;
    font-weight: 500;
}

/* ===================================
   Add Menu
   =================================== */
.canvas-add-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 100;
}

.canvas-add-btn {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.6);
}

.canvas-add-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background: #1a1a2a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.canvas-add-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.add-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.add-menu-item:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
}

.add-icon {
    font-size: 20px;
}

/* ===================================
   Delete Bin
   =================================== */
.delete-bin {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
    z-index: 100;
}

.delete-bin.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.delete-bin:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 28px rgba(220, 38, 38, 0.6);
}

/* ===================================
   Node Panel (Slide-out)
   =================================== */
.node-panel {
    position: absolute;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100%;
    background: #12121a;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

.node-panel.open {
    right: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #f0f0f0;
}

.panel-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.panel-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.panel-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.panel-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
}

.panel-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.panel-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.panel-btn-primary:hover {
    opacity: 0.9;
}

/* ===================================
   Form Elements
   =================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: #0a0a12;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #f0f0f0;
    font-size: 14px;
    transition: all 0.15s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

.form-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 24px 0;
}

.form-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #6366f1;
}

.form-note {
    font-size: 13px;
    color: #888;
    padding: 16px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    border-left: 3px solid #6366f1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #ccc;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #6366f1;
}

.connected-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.connected-item {
    padding: 12px;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 8px;
    font-size: 13px;
    color: #34d399;
}

.connected-empty {
    padding: 16px;
    text-align: center;
    color: #666;
    font-size: 13px;
    font-style: italic;
}

/* ===================================
   Tasks Dock
   =================================== */
.tasks-dock {
    position: absolute;
    left: 16px;
    bottom: 80px;
    width: 260px;
    max-height: 300px;
    background: #12121a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
}

.dock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 600;
    font-size: 14px;
    color: #e0e0e0;
}

.dock-add {
    width: 26px;
    height: 26px;
    background: #4ade80;
    border: none;
    border-radius: 6px;
    color: #0d0d14;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.dock-add:hover {
    background: #22c55e;
    transform: scale(1.1);
}

.dock-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dock-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s;
}

.dock-task:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
}

.horizon-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dock-task-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dock-empty {
    text-align: center;
    color: #555;
    font-size: 12px;
    padding: 20px;
}

/* Canvas Mode Indicator */
.fullscreen-project.canvas-mode::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    z-index: 200;
}

/* ===================================
   Canvas Chat Panel - Permanent Right Sidebar
   =================================== */
.canvas-chat {
    position: fixed;
    right: 0;
    top: 54px;
    bottom: 0;
    width: 400px;
    background: rgba(16, 16, 22, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 50;
    backdrop-filter: blur(20px);
}

/* Hide expand/minimize since always visible */
.canvas-chat .chat-header-actions {
    display: none;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.chat-title {
    font-size: 14px;
    font-weight: 600;
    color: #f0f0f0;
}

.chat-header-actions {
    display: flex;
    gap: 6px;
}

.chat-toggle,
.chat-expand {
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.15s;
}

.chat-toggle:hover,
.chat-expand:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #c4b5fd;
}

/* Chat Toolbar */
.chat-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.toolbar-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: scale(1.08);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    min-height: 200px;
}

/* Welcome Screen */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
}

.welcome-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.chat-welcome h4 {
    margin: 0 0 12px;
    color: #d0d0d0;
    font-size: 16px;
    font-weight: 500;
}

.chat-welcome p {
    margin: 4px 0;
    color: #666;
    font-size: 13px;
}

.chat-welcome strong {
    color: #a5b4fc;
}

/* Messages */
.chat-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-msg .msg-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.chat-msg .msg-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    max-width: 85%;
    font-size: 13px;
    color: #d0d0d0;
    line-height: 1.5;
}

.chat-msg.user .msg-content {
    background: rgba(99, 102, 241, 0.2);
}

.chat-msg.system .msg-content {
    background: rgba(59, 130, 246, 0.12);
    font-size: 12px;
    color: #8ab4f8;
}

.chat-msg.assistant .msg-content {
    background: rgba(34, 197, 94, 0.12);
}

/* @Mention Highlight */
.msg-mention {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* Mentions Dropdown */
.mention-dropdown {
    position: absolute;
    bottom: 100px;
    left: 14px;
    right: 14px;
    background: rgba(30, 30, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.mention-dropdown.visible {
    display: block;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
}

.mention-item:hover,
.mention-item.selected {
    background: rgba(99, 102, 241, 0.2);
}

.mention-icon {
    font-size: 16px;
}

.mention-name {
    flex: 1;
    color: #f0f0f0;
    font-size: 13px;
}

.mention-type {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* Input Area */
.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 14px;
    color: #f0f0f0;
    font-size: 13px;
    resize: none;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(255, 255, 255, 0.07);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.chat-send-btn:hover {
    transform: scale(1.08);
}

/* ===================================
   Agent Work View - Pretty Cards
   =================================== */
.agentwork-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 20px;
}

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

.agentwork-section h3 {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s;
}

.agent-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(99, 102, 241, 0.3);
}

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

.agent-icon {
    font-size: 28px;
}

.agent-card-info {
    flex: 1;
}

.agent-name {
    font-size: 15px;
    font-weight: 600;
    color: #f0f0f0;
}

.agent-type {
    font-size: 12px;
    color: #888;
}

.agent-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.agent-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.agent-status.idle {
    background: rgba(255, 255, 255, 0.05);
    color: #666;
}

.agent-card-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
}

.agent-card-stats .stat {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 18px;
    font-weight: 600;
    color: #f0f0f0;
}

.stat-label {
    font-size: 11px;
    color: #666;
}

.agent-chat-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    color: #a5b4fc;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.agent-chat-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.activity-icon {
    font-size: 18px;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 13px;
    color: #d0d0d0;
    line-height: 1.4;
}

.activity-time {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.no-agents,
.no-activity {
    text-align: center;
    padding: 24px;
    color: #555;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

/* ===================================
   Roadmap View - Timeline Style
   =================================== */
.roadmap-overview {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 24px;
    margin: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
}

.overview-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(#6366f1 calc(var(--pct) * 1%), rgba(255, 255, 255, 0.1) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.overview-circle::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: rgba(18, 18, 24, 0.95);
    border-radius: 50%;
}

.overview-circle span {
    position: relative;
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
}

.overview-label {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
}

.overview-counts {
    display: flex;
    gap: 28px;
}

.count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.count-num {
    font-size: 28px;
    font-weight: 700;
    color: #f0f0f0;
}

.count-label {
    font-size: 12px;
    color: #666;
}

/* Roadmap Lanes */
.roadmap-timeline {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.roadmap-lane {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 16px;
}

.lane-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

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

.lane-label {
    font-size: 14px;
    font-weight: 600;
    color: #f0f0f0;
}

.lane-progress {
    margin-left: auto;
    font-size: 12px;
    color: #888;
}

.lane-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}

.lane-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.lane-tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.roadmap-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.roadmap-task.completed {
    opacity: 0.5;
}

.roadmap-check {
    font-size: 14px;
    color: #888;
}

.roadmap-task.completed .roadmap-check {
    color: #4ade80;
}

.roadmap-task-title {
    font-size: 13px;
    color: #d0d0d0;
}

.no-tasks {
    text-align: center;
    padding: 12px;
    color: #555;
    font-size: 12px;
}

/* ===================================
   View Content Area
   =================================== */
.view-content {
    position: absolute;
    inset: 80px 20px 80px 20px;
    overflow-y: auto;
    display: none;
}

.view-content .view-header {
    padding: 20px 20px 0;
}

.view-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #f0f0f0;
    margin: 0 0 8px;
}

.view-header p {
    color: #888;
    font-size: 14px;
    margin: 0;
}

/* ===================================
   Agent Creator Button
   =================================== */
.create-agent-btn {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px dashed rgba(99, 102, 241, 0.4);
    border-radius: 10px;
    color: #a5b4fc;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.create-agent-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    border-color: rgba(99, 102, 241, 0.6);
    color: #c4b5fd;
}

.no-agents-msg {
    text-align: center;
    padding: 24px;
    color: #666;
    font-size: 13px;
}

/* ===================================
   Chat Attachments & Uploads
   =================================== */
.sidebar-upload-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #888);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-upload-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.upload-preview-area {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 0;
    transition: all 0.2s;
}

.upload-preview-area:empty {
    display: none;
    padding: 0;
}

/* Image file preview — compact thumbnail */
.file-preview-item {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 80px;
    flex-direction: column;
    overflow: hidden;
}

.file-preview-item.has-thumb {
    max-width: 56px;
}

.file-preview-item.has-docicon {
    max-width: 56px;
}

.preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

.preview-docicon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
}

.file-preview-name {
    font-size: 0.65rem;
    color: var(--text-secondary, #aaa);
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.file-remove-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.9);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    border: 1px solid rgba(239, 68, 68, 0.3);
    z-index: 2;
}

.file-remove-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

.chat-message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chat-attachment-img {
    max-width: 120px;
    max-height: 90px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.15s;
    object-fit: cover;
}

.chat-attachment-img:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.chat-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f0f0f0);
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.chat-attachment-file .doc-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.chat-attachment-file:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Markdown Notes Styles */
.panel-field.notes-field {
    display: flex;
    flex-direction: column;
    height: 200px;
    /* Taller */
}

.notes-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

.notes-tabs {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
    width: fit-content;
}

.notes-tab {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.notes-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-weight: 500;
}

.notes-editor,
.notes-preview {
    flex: 1;
    width: 100%;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.notes-editor {
    resize: none;
    font-family: 'JetBrains Mono', monospace;
}

.notes-preview {
    display: none;
}

.notes-preview.active {
    display: block;
}

.notes-preview h1,
.notes-preview h2,
.notes-preview h3 {
    margin-top: 0;
    margin-bottom: 0.5em;
    font-size: 1.1em;
}

.notes-preview ul {
    padding-left: 1.2em;
}

.notes-preview p {
    margin-bottom: 0.5em;
}