/* ============================================================
   Hermes Workbench — Dark Theme Stylesheet
   ============================================================ */

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-card: #1c2128;
    --bg-hover: #21262d;
    --border: #30363d;
    --border-light: #3d444d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --accent-soft: rgba(88, 166, 255, 0.15);
    --success: #238636;
    --success-bg: rgba(35, 134, 54, 0.15);
    --warning: #d29922;
    --warning-bg: rgba(210, 153, 34, 0.15);
    --danger: #da3633;
    --danger-bg: rgba(218, 54, 51, 0.15);
    --info: #2f81f7;
    --info-bg: rgba(47, 129, 247, 0.15);
    --kanban-triage: #8957e5;
    --kanban-triage-bg: rgba(137, 87, 229, 0.15);
    --kanban-todo: #8b949e;
    --kanban-ready: #d29922;
    --kanban-progress: #2f81f7;
    --kanban-blocked: #da3633;
    --kanban-review: #238636;
    --kanban-done: #3fb950;
    
    /* Shadows — NEW */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.15);
    --shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    
    /* Sidebar responsive */
    --sidebar-width: 240px;
}

/* ============================================================
   Base Styles
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   Layout
   ============================================================ */
.app {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.2s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--accent), #a371f7);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-section { margin-bottom: 16px; }

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.15s;
    text-decoration: none;
    user-select: none;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 500;
}

.nav-item .icon {
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
}

.user-chip:hover { background: var(--bg-tertiary); }

.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--kanban-review));
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.user-plan { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Collapsed sidebar hides text */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span:not(.icon),
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 8px; }
.sidebar.collapsed .nav-item .badge { display: none; }

/* ============================================================
   Main Content
   ============================================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ============================================================
   Top Bar
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-tabs {
    display: flex;
    gap: 4px;
}

.tab {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    user-select: none;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-light);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.btn:hover { background: var(--bg-tertiary); border-color: var(--border-light); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.content-inner {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================================
   View Containers
   ============================================================ */
.view-container { display: none; }
.view-container.active { display: block; }

/* ============================================================
   Hero Section (Home)
   ============================================================ */
.hero {
    text-align: center;
    padding: 40px 0 32px;
}

.hero-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ============================================================
   Prompt Input
   ============================================================ */
.prompt-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 16px;
    margin-bottom: 32px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.prompt-box:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md), 0 0 30px rgba(88, 166, 255, 0.08);
    background: #1e2530;
}

.prompt-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2), var(--shadow-md), 0 0 40px rgba(88, 166, 255, 0.1);
    background: #1e2530;
}

.prompt-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    min-height: 48px;
    font-family: inherit;
}

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

.prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.model-selector .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.complexity-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
}

.complexity-dots { display: flex; gap: 3px; }

.complexity-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}
.complexity-dot:hover { transform: scale(1.3); }
.complexity-dot.active { background: var(--accent); }

.prompt-send {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    font-size: 14px;
    flex-shrink: 0;
}
.prompt-send:hover { background: var(--accent-hover); }
.prompt-send:disabled { background: var(--text-muted); cursor: not-allowed; }
.prompt-send.loading::after {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid transparent;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.prompt-send.loading { font-size: 0; }

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    background: var(--bg-tertiary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 12px;
    color: var(--success);
}

.stat-change.negative { color: var(--danger); }

/* ============================================================
   Activity Heatmap
   ============================================================ */
.heatmap-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 32px;
}

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

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

.section-actions {
    display: flex;
    gap: 8px;
}

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

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: var(--bg-tertiary);
}

.heatmap-cell.l1 { background: rgba(35, 134, 54, 0.3); }
.heatmap-cell.l2 { background: rgba(35, 134, 54, 0.5); }
.heatmap-cell.l3 { background: rgba(35, 134, 54, 0.7); }
.heatmap-cell.l4 { background: var(--success); }

/* ============================================================
   Recent Projects
   ============================================================ */
.projects-section { margin-bottom: 32px; }

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

.project-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.project-item:hover {
    border-color: var(--border-light);
    background: var(--bg-tertiary);
}

.project-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.project-info { flex: 1; min-width: 0; }
.project-name { font-size: 14px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.project-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.project-stat { text-align: right; }
.project-stat-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.project-stat-label { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Kanban View
   ============================================================ */
.kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.kanban-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.kanban-column {
    min-width: 260px;
    max-width: 260px;
    flex-shrink: 0;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

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

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

.kanban-column-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.kanban-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(88, 166, 255, 0.08);
    transform: translateY(-4px);
    background: #1e2530;
}

.kanban-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.kanban-card-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.kanban-card-assignee {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.kanban-card-assignee-avatar {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.kanban-card-metrics {
    display: flex;
    gap: 8px;
}

.kanban-card-metric {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================
   Task Detail View
   ============================================================ */
.task-view {
    display: flex;
    gap: 20px;
    height: calc(100vh - var(--topbar-height) - 48px);
}

.task-panel-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.task-panel-right {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.task-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.task-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.task-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.task-status-badge.running {
    background: var(--info-bg);
    color: var(--info);
}

.task-status-badge.done {
    background: var(--success-bg);
    color: var(--success);
}

.task-status-badge.blocked {
    background: var(--danger-bg);
    color: var(--danger);
}

.task-status-badge.triage {
    background: var(--kanban-triage-bg);
    color: var(--kanban-triage);
}

.task-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

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

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Chat Thread */
.chat-thread {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chat-message { margin-bottom: 20px; }

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.chat-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}

.chat-avatar.user {
    background: linear-gradient(135deg, var(--accent), var(--kanban-review));
    color: #fff;
}

.chat-avatar.agent {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.chat-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.chat-body {
    margin-left: 36px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.chat-body pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

.chat-body code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

.chat-body ul { margin: 8px 0; padding-left: 20px; }
.chat-body li { margin-bottom: 4px; }

.chat-body .heartbeat {
    color: var(--text-muted);
    font-style: italic;
}

/* Tool Call Card */
.tool-call {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin: 8px 0;
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tool-call-icon {
    width: 20px; height: 20px;
    border-radius: 4px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.tool-call-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.tool-call-args {
    font-family: 'SF Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================================
   Right Panel Widgets
   ============================================================ */
.panel-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    flex-shrink: 0;
}

.widget-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Token Meter */
.token-bar-wrap { margin-bottom: 12px; }

.token-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}
.token-bar-label .label { color: var(--text-secondary); }
.token-bar-label .value { font-weight: 600; }

.token-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.token-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.token-bar-fill.input { background: var(--accent); }
.token-bar-fill.output { background: var(--success); }

.token-legend {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Subagent Info */
.subagent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subagent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
}

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

.subagent-status.running { background: var(--success); animation: pulse 1.5s infinite; }
.subagent-status.idle { background: var(--text-muted); }
.subagent-status.error { background: var(--danger); }

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

.subagent-info { flex: 1; min-width: 0; }
.subagent-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subagent-model { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.subagent-tokens {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Artefacts */
.artefact-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.artefact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
}

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

.artefact-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.artefact-info { flex: 1; min-width: 0; }
.artefact-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artefact-meta { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Loading & Offline States
   ============================================================ */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

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

.offline-banner {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   Utilities
   ============================================================ */
.hidden { display: none !important; }

.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .task-panel-right { display: none; }
    .kanban-board { padding-bottom: 16px; }
    .sidebar { width: 200px; }
    .main { margin-left: 200px; }
}

/* Mobile */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: var(--sidebar-width);
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-width); }
    
    .main { margin-left: 0; width: 100%; }
    .main.sidebar-open { filter: brightness(0.7); pointer-events: none; }
    
    /* Mobile header */
    .topbar {
        position: sticky;
        top: 0;
        z-index: 50;
        background: var(--bg-secondary);
    }
    .topbar-left { gap: 8px; }
    
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-tabs { display: none; }
    .content { padding: 12px; }
    .hero-title { font-size: 20px; }
    .hero-subtitle { font-size: 13px; }
    
    /* Kanban horizontal scroll */
    .kanban-board {
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px; /* Space for bottom nav */
    }
    .kanban-column {
        min-width: 280px;
        max-width: 280px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    
    /* Task view stacked */
    .task-view { flex-direction: column; }
    .task-panel-right {
        display: block;
        order: -1;
        margin-bottom: 16px;
    }
    
    /* Bottom navigation */
    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        z-index: 100;
        justify-content: space-around;
        align-items: center;
        padding: 0 8px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    }
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 8px 12px;
        color: var(--text-muted);
        font-size: 11px;
        cursor: pointer;
        border-radius: 8px;
        transition: all 0.15s;
    }
    .bottom-nav-item.active { color: var(--accent); }
    .bottom-nav-item .icon { font-size: 20px; }
    
    /* Content padding for bottom nav */
    .content-inner { padding-bottom: 80px; }
    
    /* Prompt box mobile */
    .prompt-box {
        margin: 0 -4px;
        border-radius: 12px;
    }
    .prompt-input { min-height: 60px; font-size: 15px; }
    
    /* Mobile overlay for sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    .sidebar-overlay.visible { display: block; }
}

/* Extra small */
@media (max-width: 480px) {
    .hero-title { font-size: 18px; }
    .stats-grid { gap: 8px; }
    .stat-card { padding: 12px; }
    .kanban-column { min-width: 260px; max-width: 260px; }
    .task-meta-row { flex-direction: column; gap: 4px; }
}

/* Mobile hamburger */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}
.mobile-menu-toggle:hover { background: var(--bg-hover); }

/* Bottom nav (hidden on desktop) */
.bottom-nav { display: none; }

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
}

/* ═══ Settings + Stats ═══ */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); }

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

.settings-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}
.settings-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    background: #1e2530;
}

.settings-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.settings-row:last-child { border-bottom: none; }

.settings-input, .settings-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 13px;
    min-width: 160px;
    outline: none;
    transition: all 0.2s;
}
.settings-input:focus, .settings-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: 0.2s;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent-soft); border-color: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); background: var(--accent); }
.toggle input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

.settings-info { font-size: 13px; }
.settings-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.settings-info-row:last-child { border-bottom: none; }

/* Stat bars */
.stat-bars { padding: 8px 0; }
.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
}
.stat-bar-label { min-width: 120px; color: var(--text-secondary); }
.stat-bar-track { flex: 1; height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s ease; }
.stat-bar-value { min-width: 30px; text-align: right; color: var(--text-muted); font-size: 12px; }

/* Nav-item hover enhancement */
.nav-item {
    transition: all 0.2s ease;
}
.nav-item:hover {
    background: var(--accent-soft);
    border-radius: 8px;
}
.nav-item.active {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
}

