:root {
    --baby-blue: #A7C7E7;
    --grassy-green: #7BB661;
    --lavender: #C9A0DC;
    --sunny-yellow: #FFF275;
    --soft-peach: #FFD8B1;
    --light-gray: #E8E8E8;
    --creamy-white: #FFFDF7;
    --dark-text: #2c3e50;
    --medium-text: #546e7a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--baby-blue);
    color: var(--dark-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--creamy-white);
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--sunny-yellow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.mission-display {
    font-size: 0.9em;
    color: var(--medium-text);
}

.mission-label {
    color: #6b7280;
    margin-right: 6px;
}

.mission-name {
    font-weight: 600;
    color: var(--dark-text);
}

.header-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border: 2px solid rgba(123, 182, 97, 0.25);
    overflow: hidden;
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header h1 {
    font-size: 1.8em;
    color: var(--grassy-green);
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tree-view {
    font-size: 0.75em;
    color: var(--medium-text);
    font-family: 'Monaco', 'Menlo', monospace;
    background: rgba(0,0,0,0.05);
    padding: 6px 10px;
    border-radius: 6px;
    white-space: pre;
    line-height: 1.4;
}

.feature-selector {
    min-width: 300px;
}

.feature-selector label {
    display: block;
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 5px;
    font-weight: 500;
}

.feature-selector select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--lavender);
    border-radius: 8px;
    font-size: 1em;
    background: var(--creamy-white);
    color: var(--dark-text);
    cursor: pointer;
    transition: all 0.2s;
}

.feature-selector select:hover {
    border-color: var(--grassy-green);
    background: white;
}

.feature-selector select:focus {
    outline: none;
    border-color: var(--grassy-green);
    box-shadow: 0 0 0 3px rgba(123, 182, 97, 0.2);
}

.last-update {
    font-size: 0.85em;
    color: var(--medium-text);
}

.sidebar-last-update {
    margin: 6px 30px 20px;
    display: block;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: var(--creamy-white);
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    border-right: 2px solid var(--light-gray);
}

.sidebar-item {
    padding: 12px 30px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-text);
}

.sidebar-item:hover {
    background: rgba(201, 160, 220, 0.15);
    color: var(--grassy-green);
}

.sidebar-item.active {
    background: rgba(123, 182, 97, 0.1);
    border-left-color: var(--grassy-green);
    color: var(--grassy-green);
    font-weight: 600;
}

.sidebar-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sidebar-item.disabled:hover {
    background: transparent;
    color: #4b5563;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.content-card {
    background: var(--creamy-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    border-top: 3px solid var(--sunny-yellow);
}

.content-card h2 {
    color: var(--grassy-green);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--soft-peach);
}

.markdown-content {
    line-height: 1.6;
    color: #374151;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: #1f2937;
}

.markdown-content p {
    margin-bottom: 12px;
}

.markdown-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #ffffff;
    color: #111827;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.markdown-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.markdown-content ul, .markdown-content ol {
    margin-left: 24px;
    margin-bottom: 12px;
}

/* Status summary styles */
.status-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.status-card {
    background: linear-gradient(135deg, var(--creamy-white) 0%, #fafaf8 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid;
}

.status-card.total { border-left-color: var(--baby-blue); }
.status-card.progress { border-left-color: var(--sunny-yellow); }
.status-card.review { border-left-color: var(--lavender); }
.status-card.completed { border-left-color: var(--grassy-green); }
.status-card.agents { border-left-color: var(--soft-peach); }

.merge-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #34d399;
    margin-left: 12px;
    white-space: nowrap;
}

.merge-badge .icon {
    font-size: 1em;
}

.status-label {
    font-size: 0.85em;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    font-size: 2.5em;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.status-detail {
    font-size: 0.85em;
    color: #9ca3af;
    margin-top: 6px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--grassy-green) 0%, #5a9647 100%);
    transition: width 0.3s ease;
}

/* Kanban board styles */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.lane {
    background: var(--creamy-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 400px;
    border-top: 3px solid;
}

.lane-header {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lane-header .count {
    font-size: 0.8em;
    background: rgba(0,0,0,0.08);
    padding: 4px 10px;
    border-radius: 12px;
}

.lane.planned { border-top-color: var(--baby-blue); }
.lane.planned .lane-header { border-color: var(--baby-blue); color: var(--baby-blue); }

.lane.doing { border-top-color: var(--sunny-yellow); }
.lane.doing .lane-header { border-color: var(--sunny-yellow); color: #d4a800; }

.lane.for_review { border-top-color: var(--lavender); }
.lane.for_review .lane-header { border-color: var(--lavender); color: var(--lavender); }

.lane.done { border-top-color: var(--grassy-green); }
.lane.done .lane-header { border-color: var(--grassy-green); color: var(--grassy-green); }

.card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: var(--creamy-white);
}

.lane.planned .card { border-left-color: var(--baby-blue); }
.lane.doing .card { border-left-color: var(--sunny-yellow); }
.lane.for_review .card { border-left-color: var(--lavender); }
.lane.done .card { border-left-color: var(--grassy-green); }

.card-id {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.card-title {
    font-size: 1.05em;
    font-weight: 500;
    margin-bottom: 8px;
    color: #1f2937;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
}

.badge.agent {
    background: var(--soft-peach);
    color: #8b5a00;
}

.badge.subtasks {
    background: var(--lavender);
    color: #5a3a6e;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 40px 20px;
    font-style: italic;
}

body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.65);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 900px;
    width: min(90%, 900px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.modal-title {
    font-size: 1.35em;
    font-weight: 600;
    color: #1f2937;
}

.modal-subtitle {
    font-size: 0.9em;
    color: #6b7280;
    margin-top: 4px;
}

.modal-close {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 1.2em;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
    color: #1f2937;
}

.modal-body {
    position: relative;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.modal-meta span {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 0.85em;
    color: #4b5563;
}

.modal-content .markdown-content {
    padding: 0;
}

.modal-content .markdown-content pre {
    background: #ffffff;
    color: #111827;
}

.no-features {
    text-align: center;
    padding: 60px 40px;
}

.no-features h2 {
    color: white;
    margin-bottom: 15px;
}

.no-features p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

@media (max-width: 1400px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Markdown content styling */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: var(--dark-text);
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content h1 { font-size: 1.8em; }
.markdown-content h2 { font-size: 1.5em; }
.markdown-content h3 { font-size: 1.3em; }
.markdown-content h4 { font-size: 1.1em; }

.markdown-content p {
    margin-bottom: 1em;
    line-height: 1.6;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: 0.3em;
    line-height: 1.6;
}

.markdown-content blockquote {
    border-left: 4px solid var(--lavender);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--medium-text);
    background: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
}

.markdown-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.9em;
    color: #c7254e;
}

.markdown-content pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    margin-bottom: 1em;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: #212529;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.markdown-content table th {
    background: var(--baby-blue);
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #ddd;
}

.markdown-content table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.markdown-content table tr:nth-child(even) {
    background: #f9f9f9;
}

.markdown-content hr {
    border: none;
    border-top: 2px solid var(--light-gray);
    margin: 2em 0;
}

.markdown-content a {
    color: var(--grassy-green);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em 0;
}

/* Media Queries */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
    .kanban-board {
        grid-template-columns: 1fr;
    }
}
