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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: #2c3e50;
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 28px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-version {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.header-version-meta {
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
    opacity: 0.9;
}

header .subtitle {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 5px;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.nav-tabs button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-tabs button.active {
    color: #2c3e50;
    border-bottom-color: #3498db;
}

.nav-tabs button:hover {
    color: #2c3e50;
}

.content-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3498db;
    cursor: pointer;
    transition: all 0.3s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card.deleted {
    opacity: 0.7;
    border-left-color: #b2bec3;
    background: #f6f7f8;
}

.card.deleted:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #2c3e50;
}

.card-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #cfe2ff;
    color: #084298;
}

.status-in-progress {
    background: #e2e3e5;
    color: #383d41;
}

.status-offline {
    background: #f8d7da;
    color: #721c24;
}

.status-plan-none {
    background: #e2e3e5;
    color: #383d41;
    margin-left: 8px;
}

.status-plan-planning {
    background: #fff3cd;
    color: #856404;
    margin-left: 8px;
}

.status-plan-proposed {
    background: #cce5ff;
    color: #004085;
    margin-left: 8px;
}

.status-plan-approved {
    background: #d4edda;
    color: #155724;
    margin-left: 8px;
}

.stats {
    display: flex;
    gap: 15px;
    margin-top: 12px;
    font-size: 14px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group select {
    padding: 10px 12px;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="%23666" stroke-width="2" stroke-linecap="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    transition: all 0.3s;
}

.form-group select:hover {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.2);
}

.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.4);
}

.form-group select option {
    padding: 10px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.4);
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: #95a5a6;
}

button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2);
}

button:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(52, 152, 219, 0.2);
}

button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.danger {
    background: #e74c3c;
}

button.danger:hover {
    background: #c0392b;
}

button.small {
    padding: 6px 12px;
    font-size: 12px;
}

button.ghost {
    background: #ecf0f1;
    color: #2c3e50;
    box-shadow: none;
}

button.ghost:hover {
    background: #dfe6e9;
    transform: none;
    box-shadow: none;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.task-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.task-item:hover .task-toolbar {
    opacity: 1;
}

.task-toolbar-btn {
    background: rgba(255,255,255,0.92);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
}

.task-toolbar-btn:hover {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.task-toolbar-btn.danger:hover {
    background: #fdf2f2;
    border-color: #e74c3c;
}

.milestone-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.milestone-item {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

.milestone-index {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2c3e50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.milestone-title {
    font-weight: 600;
    color: #2c3e50;
}

.milestone-desc {
    margin-top: 4px;
    color: #666;
    font-size: 13px;
}

.plan-status-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

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

.plan-summary {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #fafafa;
    color: #555;
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.plan-notes {
    font-size: 12px;
    color: #7a4f2a;
    background: #fff6e0;
    border: 1px solid #f2e0b3;
    padding: 6px 8px;
    border-radius: 6px;
}

.plan-latest {
    margin-left: 8px;
    font-size: 12px;
    color: #6c757d;
}

.plan-tasks {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.plan-task {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #eee;
}

.plan-task-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.plan-task-meta {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.plan-empty {
    color: #999;
    font-size: 13px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.timeline-modal {
    max-width: 700px;
    max-height: 80vh;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.timeline-modal h2 {
    margin-bottom: 20px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #333;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.task-tree {
    margin-top: 15px;
}

.task-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 3px solid #3498db;
}

.task-item.completed {
    border-left-color: #2ecc71;
}

.task-item.pending {
    border-left-color: #f39c12;
}

.task-item.failed {
    border-left-color: #e74c3c;
    background: #fdf2f2;
}

.task-failure {
    margin-top: 8px;
    font-size: 12px;
    color: #b03a2e;
    background: #fcebea;
    border: 1px solid #f5c6cb;
    padding: 6px 8px;
    border-radius: 6px;
}

.task-retries {
    margin-top: 6px;
    font-size: 12px;
    color: #5b3b00;
    background: #fff2cc;
    border: 1px solid #ffe08a;
    padding: 6px 8px;
    border-radius: 6px;
}

.subtask-item {
    margin-left: 20px;
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-left: 2px dashed #bbb;
    padding-left: 15px;
}

.subtask-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.subtask-status {
    font-size: 12px;
    color: #666;
}

.worker-card {
    border-left-color: #9b59b6;
}

.worker-card.online {
    border-left-color: #27ae60;
}

.worker-card.offline {
    border-left-color: #e74c3c;
}

.refresh-info {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table th {
    background: #f0f0f0;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.table tr:hover {
    background: #f9f9f9;
}

/* Type badges with icons */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

.type-badge-code {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.type-badge-files {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.type-badge-execute {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.type-badge-clarify {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.type-badge-plan {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #4a2c2a;
}

.type-badge-breakdown {
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    color: #1b3c6b;
}

.type-badge-test {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #5a2a00;
}

/* Enhanced select with icon wrapper */
.select-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #2c3e50;
    cursor: pointer;
    user-select: none;
}

.toggle input {
    display: none;
}

.toggle-pill {
    position: relative;
    width: 44px;
    height: 24px;
    background: #dfe6e9;
    border-radius: 20px;
    transition: background 0.2s ease;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
}

.toggle-pill::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.toggle input:checked+.toggle-pill {
    background: #3498db;
}

.toggle input:checked+.toggle-pill::after {
    transform: translateX(20px);
}

.select-icon {
    position: absolute;
    left: 12px;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.select-with-icon select {
    padding-left: 42px;
}