/* ===== CSS Variables ===== */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-accent: #0f3460;
    --bg-card: #16213e;
    --bg-hover: #1f2b47;
    
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --border-color: #27374d;
    --border-light: #3d4f6f;
    
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-purple: #a855f7;
    --accent-gray: #6b7280;
    
    --dot-todo: #3b82f6;
    --dot-progress: #eab308;
    --dot-done: #22c55e;
    --dot-archive: #6b7280;
    
    --sidebar-width: 240px;
    --tab-height: 48px;
}

/* Insights Tab Styles */
.insights-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    height: calc(100vh - 100px);
}

.insights-sidebar {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.insights-sidebar h3, .insights-sidebar h4 {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    margin: 16px 0 8px 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.insights-sidebar h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 0;
}

.memory-file {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
    margin-bottom: 2px;
}

.memory-file:hover {
    background: var(--bg-hover);
}

.memory-file.active {
    background: var(--bg-accent);
    color: var(--accent-blue);
}

.entry-count {
    background: var(--bg-accent);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.no-files {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    padding: 8px 12px;
}

.quick-add {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.quick-add select, .quick-add textarea, .quick-add button {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
}

.quick-add select:focus, .quick-add textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-primary);
}

.quick-add textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.quick-add button {
    background: var(--accent-blue);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.quick-add button:hover {
    background: #2563eb;
}

.quick-add button:active {
    background: #1d4ed8;
}

.insights-main {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.search-bar input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 14px;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-primary);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.memory-content {
    line-height: 1.7;
    color: var(--text-primary);
}

.memory-content h1 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: 600;
}

.memory-content h2 {
    color: var(--text-primary);
    margin: 20px 0 12px 0;
    font-size: 18px;
    font-weight: 600;
}

.memory-content h3 {
    color: var(--accent-blue);
    margin: 16px 0 8px 0;
    font-size: 16px;
    font-weight: 500;
}

.memory-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.memory-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.search-result {
    padding: 12px;
    background: var(--bg-accent);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid var(--border-color);
}

.search-result:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.search-result strong {
    color: var(--accent-blue);
    font-weight: 600;
}

.search-result p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.error {
    color: var(--accent-red);
    padding: 20px;
    text-align: center;
    font-weight: 500;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== App Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.avatar-section {
    text-align: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.avatar-placeholder {
    font-size: 36px;
}

.agent-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.status-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-gray);
    transition: background-color 0.3s ease;
}

.status-dot.idle {
    background-color: var(--accent-gray);
}

.status-dot.thinking {
    background-color: var(--accent-yellow);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.working {
    background-color: var(--accent-green);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: var(--tab-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 0 20px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-blue);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-blue);
}

/* ===== Tab Content ===== */
.tab-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.tab-pane {
    display: none;
    height: 100%;
}

.tab-pane.active {
    display: block;
}

/* ===== Kanban Board ===== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    min-height: calc(100vh - var(--tab-height) - 100px);
}

.kanban-column {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

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

.column-dot.todo { background-color: var(--dot-todo); }
.column-dot.progress { background-color: var(--dot-progress); }
.column-dot.done { background-color: var(--dot-done); }
.column-dot.archive { background-color: var(--dot-archive); }

.column-count {
    font-size: 12px;
    color: var(--text-muted);
    background-color: var(--bg-accent);
    padding: 2px 8px;
    border-radius: 10px;
}

.add-task-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.add-task-btn:hover {
    background-color: var(--bg-accent);
    color: var(--text-primary);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

.task-card {
    background-color: var(--bg-accent);
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.task-card:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.task-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.task-dot.todo { background-color: var(--dot-todo); }
.task-dot.progress { background-color: var(--dot-progress); }
.task-dot.done { background-color: var(--dot-done); }
.task-dot.archive { background-color: var(--dot-archive); }

.task-title {
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.task-date {
    font-size: 11px;
    color: var(--text-muted);
}

.task-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.task-card.expanded .task-details {
    display: block;
}

.show-more-btn {
    background: none;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.show-more-btn:hover {
    border-color: var(--border-light);
    color: var(--text-secondary);
}

/* ===== Activity Log ===== */
.log-container {
    max-width: 800px;
}

.log-day-group {
    margin-bottom: 24px;
}

.log-day-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.log-day-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.log-day-count {
    font-size: 12px;
    color: var(--text-muted);
    background-color: var(--bg-accent);
    padding: 2px 8px;
    border-radius: 10px;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.log-entry:hover {
    background-color: var(--bg-hover);
}

.log-time {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    min-width: 50px;
}

.log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.log-dot.system { background-color: var(--accent-blue); }
.log-dot.task { background-color: var(--accent-green); }
.log-dot.error { background-color: var(--accent-red); }
.log-dot.heartbeat { background-color: var(--accent-yellow); }
.log-dot.info { background-color: var(--accent-gray); }

.log-message {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

/* ===== Docs Viewer ===== */
.docs-container {
    display: flex;
    height: calc(100vh - var(--tab-height) - 48px);
    gap: 24px;
}

.docs-sidebar {
    width: 250px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.docs-search {
    margin-bottom: 16px;
}

.docs-search input {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.docs-search input::placeholder {
    color: var(--text-muted);
}

.docs-search input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.docs-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.docs-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-item:hover {
    background-color: var(--bg-hover);
}

.docs-item.active {
    background-color: var(--bg-accent);
    color: var(--text-primary);
}

.docs-item-icon {
    font-size: 12px;
}

.docs-viewer {
    flex: 1;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.docs-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.docs-viewer-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.docs-edit-btn {
    background-color: var(--bg-accent);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.docs-edit-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.docs-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.docs-content h1 { font-size: 24px; margin-bottom: 16px; color: var(--text-primary); }
.docs-content h2 { font-size: 20px; margin: 24px 0 12px; color: var(--text-primary); }
.docs-content h3 { font-size: 16px; margin: 20px 0 8px; color: var(--text-primary); }
.docs-content p { margin-bottom: 12px; color: var(--text-secondary); line-height: 1.7; }
.docs-content ul, .docs-content ol { margin-bottom: 12px; padding-left: 24px; color: var(--text-secondary); }
.docs-content li { margin-bottom: 6px; }
.docs-content code {
    background-color: var(--bg-accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
}
.docs-content pre {
    background-color: var(--bg-accent);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.docs-content pre code {
    background: none;
    padding: 0;
}
.docs-content blockquote {
    border-left: 3px solid var(--accent-blue);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-muted);
    font-style: italic;
}

.docs-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: column;
        padding: 16px;
        max-height: 180px;
        overflow: hidden;
    }
    
    .agent-profile {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .agent-profile .avatar {
        width: 40px;
        height: 40px;
        margin: 0;
    }
    
    .agent-profile .avatar-placeholder {
        font-size: 20px;
    }
    
    .agent-profile .agent-name {
        font-size: 16px;
        margin: 0;
    }
    
    .agent-profile .agent-info {
        display: none;
    }
    
    .agent-separator {
        display: none;
    }
    
    #alerts-container {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        min-height: auto;
    }
    
    .tab-nav {
        overflow-x: auto;
        padding: 0 8px;
    }
    
    .tab-btn {
        padding: 12px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .tab-content {
        padding: 12px;
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .kanban-column {
        min-height: auto;
    }
    
    .docs-container {
        flex-direction: column;
    }
    
    .docs-sidebar {
        width: 100%;
        max-height: 200px;
    }
}

/* ===== Copilot Jobs ===== */
.copilot-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--tab-height) - 48px);
}

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

.copilot-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.copilot-stats {
    display: flex;
    gap: 16px;
}

.copilot-stats .stat {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.copilot-stats .stat.completed { color: var(--accent-green); }
.copilot-stats .stat.running { color: var(--accent-yellow); }
.copilot-stats .stat.pending { color: var(--accent-blue); }

.copilot-content {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.jobs-list {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex-shrink: 0;
}

.job-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.job-card:hover {
    border-color: var(--border-light);
}

.job-card.selected {
    border-color: var(--accent-blue);
    background: var(--bg-accent);
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.job-id {
    font-size: 12px;
    font-family: 'SF Mono', Monaco, monospace;
    color: var(--text-muted);
}

.job-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-accent);
}

.job-status.completed { color: var(--accent-green); }
.job-status.running { color: var(--accent-yellow); }
.job-status.pending { color: var(--accent-blue); }
.job-status.failed { color: var(--accent-red); }

.job-card-title {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.job-detail {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow-y: auto;
}

.job-detail-content {
    padding: 20px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.detail-header h3 {
    font-size: 18px;
    color: var(--text-primary);
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.detail-item .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-item .value {
    font-size: 14px;
    color: var(--text-secondary);
}

.code-block {
    background: var(--bg-accent);
    border-radius: 6px;
    padding: 16px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.log-viewer {
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.log-viewer pre {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    white-space: pre-wrap;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 100px;
    color: var(--text-muted);
    font-size: 14px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-path {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    color: var(--accent-blue);
    padding: 8px 12px;
    background: var(--bg-accent);
    border-radius: 4px;
}

/* ===== Docs Editor ===== */
.docs-editor {
    width: 100%;
    height: calc(100vh - 200px);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.docs-editor:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* ===== Dual Agent Profiles ===== */
.agent-profile {
    margin-bottom: 16px;
}

.agent-profile .avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    position: relative;
}

.agent-profile .agent-name {
    font-size: 18px;
    margin-bottom: 6px;
}

.agent-profile .status-dot {
    width: 12px;
    height: 12px;
    position: absolute;
    bottom: 2px;
    right: 2px;
    border: 2px solid var(--bg-secondary);
}

.agent-separator {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

/* ===== Task Assignee Badges ===== */
.task-assignee {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 8px;
    display: inline-block;
}

.task-assignee.hex {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
}

.task-assignee.developer {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.log-agent {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 80px;
    font-weight: 500;
}

/* ===== Conversation/Chat Styles ===== */
.detail-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.detail-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 14px;
    transition: all 0.2s;
}

.detail-tab:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
}

.detail-tab.active {
    background: var(--bg-accent);
    color: var(--accent-blue);
    border-bottom: 2px solid var(--accent-blue);
}

.detail-tab-content {
    display: none;
}

.detail-tab-content.active {
    display: block;
}

.conversation-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.chat-message.user {
    flex-direction: row;
}

.chat-message.assistant {
    flex-direction: row;
}

.chat-message.system {
    justify-content: center;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-bubble {
    background: var(--bg-accent);
    border-radius: 12px;
    padding: 12px 16px;
    max-width: 80%;
    border: 1px solid var(--border-color);
}

.chat-message.user .chat-bubble {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.chat-message.assistant .chat-bubble {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.chat-bubble.system {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    text-align: center;
}

.chat-bubble.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.chat-role {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-message.user .chat-role {
    color: var(--accent-purple);
}

.chat-message.assistant .chat-role {
    color: var(--accent-green);
}

.chat-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ===== Updated Log Viewer ===== */
.log-viewer {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 400px;
    overflow: auto;
}

.log-viewer pre {
    margin: 0;
    padding: 16px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===== Kanban Header ===== */
.kanban-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.kanban-header .add-task-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.kanban-header .add-task-btn:hover {
    background: #2563eb;
}

/* ===== Drag and Drop ===== */
.task-card[draggable="true"] {
    cursor: grab;
}

.task-card[draggable="true"]:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.task-list.drag-over {
    background: rgba(59, 130, 246, 0.1);
    border: 2px dashed var(--accent-blue);
    border-radius: 6px;
    min-height: 100px;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.modal-content h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.modal-content select {
    cursor: pointer;
}

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

.modal-actions button {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions button:first-child {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.modal-actions button:first-child:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-actions button.primary {
    background: var(--accent-blue);
    border: none;
    color: white;
}

.modal-actions button.primary:hover {
    background: #2563eb;
}

/* ===== Enhanced Kanban Styles ===== */

/* Quick Add Form */
.quick-add-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.form-row:last-child {
    margin-bottom: 0;
}

.quick-input {
    flex: 2;
    padding: 8px 12px;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.quick-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.quick-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.quick-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.quick-add-btn {
    padding: 8px 16px;
    background: var(--accent-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.quick-add-btn:hover {
    background: #16a34a;
}

/* Enhanced Task Cards */
.task-header {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.task-priority {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.priority-urgent {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.priority-normal {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.priority-low {
    background: rgba(107, 114, 128, 0.2);
    color: var(--accent-gray);
}

.task-category {
    font-size: 12px;
    padding: 1px 4px;
    background: var(--bg-accent);
    border-radius: 3px;
    opacity: 0.8;
}

.task-effort {
    font-size: 12px;
    padding: 1px 4px;
    background: var(--bg-hover);
    border-radius: 3px;
    opacity: 0.9;
}

.task-job-link {
    font-size: 12px;
    color: var(--accent-purple);
    cursor: help;
}

.task-due-date {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(234, 179, 8, 0.2);
    color: var(--accent-yellow);
    margin-left: auto;
}

.task-due-date.overdue {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    font-weight: 600;
}

.task-card.task-overdue {
    border-left: 3px solid var(--accent-red);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.task-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quick-input,
    .quick-select {
        flex: 1;
    }
    
    .kanban-board {
        flex-direction: column;
        gap: 16px;
    }
    
    .kanban-column {
        min-width: auto;
        width: 100%;
    }
    
    .task-header {
        flex-wrap: wrap;
    }
}

/* ===== Alerts Panel ===== */
.alerts-panel {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.alerts-header {
    padding: 12px 16px;
    background: var(--bg-accent);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}

.alert-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.alert-badge.warning {
    background: rgba(234, 179, 8, 0.2);
    color: var(--accent-yellow);
}

.alerts-list {
    max-height: 200px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

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

.alert-item:hover {
    background: var(--bg-hover);
}

.alert-item.critical {
    border-left: 3px solid var(--accent-red);
}

.alert-item.warning {
    border-left: 3px solid var(--accent-yellow);
}

.alert-item.info {
    border-left: 3px solid var(--accent-blue);
}

.alert-icon {
    font-size: 14px;
    margin-right: 12px;
    flex-shrink: 0;
}

.alert-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.3;
}

.dismiss-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 8px;
}

.dismiss-btn:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
}

.show-all {
    display: block;
    text-align: center;
    padding: 12px 16px;
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    border-top: 1px solid var(--border-color);
    transition: background 0.2s;
}

.show-all:hover {
    background: var(--bg-hover);
}

/* Loading skeleton */
.loading-skeleton {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
}

