:root {
    --bg-primary: #faf9f7;
    --bg-secondary: #f5f4f2;
    --bg-tertiary: #ffffff;
    --bg-sidebar: #2d2b29;
    --bg-sidebar-hover: #3d3b38;
    --text-primary: #1a1915;
    --text-secondary: #6b6860;
    --text-tertiary: #9b958c;
    --text-inverse: #faf9f7;
    --accent: #c96442;
    --accent-hover: #b85a3a;
    --accent-light: rgba(201, 100, 66, 0.1);
    --success: #3d8c40;
    --success-light: rgba(61, 140, 64, 0.1);
    --warning: #b8860b;
    --warning-light: rgba(184, 134, 11, 0.1);
    --error: #c53030;
    --error-light: rgba(197, 48, 48, 0.1);
    --running: #e67e22;
    --running-light: rgba(230, 126, 34, 0.15);
    --border: #e8e6e3;
    --border-subtle: #f0eeeb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.yggdrasil-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--bg-sidebar);
    padding: 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h2 {
    color: var(--text-inverse);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-header .version {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 400;
    margin-top: 0.125rem;
}

.sidebar-header .logo-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar-header .logo-title svg {
    flex-shrink: 0;
}

.nav-menu {
    list-style: none;
    padding: 0.75rem 0.75rem;
    flex: 1;
}

.nav-menu li {
    margin-bottom: 0.125rem;
}

.nav-menu a {
    display: block;
    padding: 0.625rem 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    font-size: 0.875rem;
    font-weight: 450;
}

.nav-menu a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-inverse);
}

.nav-menu a.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-inverse);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.user-icon {
    font-size: 1rem;
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    display: block;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    text-align: center;
    transition: all 0.15s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-inverse);
}

.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 2rem 2.5rem;
    max-width: 1400px;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h4 {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    font-weight: 450;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--error);
    color: white;
    border: 1px solid var(--error);
}

.btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.75rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-success {
    background: var(--success-light);
    color: var(--success);
}

.status-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.status-error, .status-failed {
    background: var(--error-light);
    color: var(--error);
}

.status-running {
    background: var(--running-light);
    color: var(--running);
}

.status-pending {
    background: var(--border);
    color: var(--text-primary);
}

.status-cancelled {
    background: var(--border);
    color: var(--text-secondary);
}

.status-info {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.status-knowledge {
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
}

/* Module type badges */
.status-library {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.status-executable {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.status-artifact {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.status-integrationtest {
    background: rgba(20, 184, 166, 0.15);
    color: #0d9488;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 0.5rem;
    text-align: left;
}

th {
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-secondary);
}

input, select, textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder {
    color: var(--text-tertiary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.log-output {
    background: var(--bg-sidebar);
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    color: rgba(255, 255, 255, 0.85);
}

.log-line {
    padding: 0.125rem 0;
    line-height: 1.5;
}

.log-info { color: rgba(255, 255, 255, 0.6); }
.log-success { color: #4ade80; }
.log-warning { color: #fbbf24; }
.log-error { color: #f87171; }

.badge {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.seeker-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
    margin-right: 8px;
    box-shadow: 0 0 0 2px var(--success-light);
}

.workspace-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 8px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 25, 21, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    min-width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.tree-view {
    padding: 0.25rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.tree-node {
    padding: 0.0625rem 0;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s ease;
}

.tree-item:hover {
    background: var(--bg-secondary);
}

.tree-toggle {
    width: 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    cursor: pointer;
}

.tree-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.875rem;
}

.tree-meta {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-right: 0.5rem;
}

.tree-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.tree-item:hover .tree-actions {
    opacity: 1;
}

.module-item .tree-label {
    font-weight: 400;
}

.module-icon {
    font-size: 0.6875rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    box-shadow: 0 0 0 2px var(--bg-tertiary), 0 0 0 4px var(--text-primary);
}

.branch-list, .commit-list, .commit-list-full {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.375rem;
    max-height: 300px;
    overflow-y: auto;
}

.branch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    transition: background-color 0.15s ease;
}

.branch-item-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    cursor: pointer;
}

.branch-item:hover {
    background: var(--bg-tertiary);
}

.branch-download-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    white-space: nowrap;
    text-decoration: none;
}

.branch-item:hover .branch-download-btn {
    opacity: 1;
}

.branch-item.selected .branch-download-btn {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.branch-item.selected .branch-download-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.branch-item.current {
    background: var(--accent-light);
}

.branch-item.selected {
    background: var(--accent);
    color: white;
}

.branch-item.selected .branch-tip {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.branch-indicator {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.branch-icon {
    width: 1rem;
    color: var(--success);
    font-weight: 600;
    font-size: 0.875rem;
}

.branch-name {
    flex: 1;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8125rem;
}

.branch-tip {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.commit-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.625rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    align-items: center;
}

.commit-item:hover {
    background: var(--bg-tertiary);
}

.commit-hash {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.6875rem;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-weight: 500;
}

.commit-message {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.commit-meta {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.empty-state {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

.text-muted {
    color: var(--text-secondary);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

/* Scrollable containers */
.scrollable-list {
    max-height: 300px;
    overflow-y: auto;
}

.scrollable-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

/* Custom scrollbar styling */
.tree-view::-webkit-scrollbar,
.branch-list::-webkit-scrollbar,
.commit-list::-webkit-scrollbar,
.commit-list-full::-webkit-scrollbar,
.scrollable-list::-webkit-scrollbar,
.scrollable-table-wrapper::-webkit-scrollbar,
.log-output::-webkit-scrollbar {
    width: 6px;
}

.tree-view::-webkit-scrollbar-track,
.branch-list::-webkit-scrollbar-track,
.commit-list::-webkit-scrollbar-track,
.commit-list-full::-webkit-scrollbar-track,
.scrollable-list::-webkit-scrollbar-track,
.scrollable-table-wrapper::-webkit-scrollbar-track,
.log-output::-webkit-scrollbar-track {
    background: transparent;
}

.tree-view::-webkit-scrollbar-thumb,
.branch-list::-webkit-scrollbar-thumb,
.commit-list::-webkit-scrollbar-thumb,
.commit-list-full::-webkit-scrollbar-thumb,
.scrollable-list::-webkit-scrollbar-thumb,
.scrollable-table-wrapper::-webkit-scrollbar-thumb,
.log-output::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.tree-view::-webkit-scrollbar-thumb:hover,
.branch-list::-webkit-scrollbar-thumb:hover,
.commit-list::-webkit-scrollbar-thumb:hover,
.commit-list-full::-webkit-scrollbar-thumb:hover,
.scrollable-list::-webkit-scrollbar-thumb:hover,
.scrollable-table-wrapper::-webkit-scrollbar-thumb:hover,
.log-output::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}
