:root {
    --color-bg: #ffffff;
    --color-text: #111111;
    --color-text-muted: #6b6b6b;
    --color-border: #e8e8e8;
    --color-weekend: #f9f9f9;
    --color-milestone: #111111;
    --color-final-milestone: #e63225;
    --color-accent: #e63225;
    --color-navbar: #6ec828;
    --day-width: 32px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.navbar {
    background: var(--color-navbar);
    color: white;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #000;
}

.navbar-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
    font-weight: 500;
    font-size: 1.1rem;
}

.logo svg {
    height: 24px;
    width: auto;
}

.navbar-project {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    font-weight: 400;
}

.badge {
    display: inline-block;
    background: var(--color-accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

section {
    background: white;
    border: 1px solid var(--color-border);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.project-summary {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.8;
}

.timeline-wrapper {
    overflow-y: visible;
    padding-bottom: 1rem;
}

.timeline-scroll-area {
    overflow-x: auto;
    overflow-y: visible;
}

.timeline-container {
    min-width: 100%;
    width: max-content;
    position: relative;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.hint {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

#color-palette-container {
    margin-bottom: 1rem;
    position: sticky;
    top: 60px;
    z-index: 100;
    background: white;
    padding-top: 0.5rem;
}

.color-palette {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #fafafa;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    flex-wrap: wrap;
}

.color-palette-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    color: var(--color-text);
}

.color-option-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-option.eraser {
    background: white;
    border: 2px solid var(--color-border);
    position: relative;
}

.color-option.eraser::after {
    content: "✕";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: var(--color-text-muted);
}

.legend-input {
    width: 100px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-size: 0.75rem;
    text-align: center;
    font-family: inherit;
}

.legend-input:focus {
    outline: none;
    border-color: var(--color-text);
}

.legend-color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.day-marks-row {
    display: flex;
    margin-top: 0.5rem;
    position: relative;
}

.day-marks-label {
    width: 200px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    padding-right: 1rem;
    display: flex;
    align-items: center;
}

.day-marks-track {
    flex: 1;
    display: flex;
}

.day-mark {
    width: var(--day-width);
    height: 20px;
    border-right: 1px solid var(--color-border);
    cursor: pointer;
    transition: opacity 0.15s;
    background: white;
}

.day-mark:hover {
    opacity: 0.7;
}

.day-mark.marked {
    border: 1px solid rgba(0,0,0,0.2);
}

.day-mark.weekend {
    background: var(--color-weekend);
    cursor: not-allowed;
}

.day-mark.weekend:hover {
    opacity: 1;
}

.day-mark.weekend {
    background: var(--color-weekend);
    cursor: not-allowed;
}

.day-mark.weekend:hover {
    opacity: 1;
}

.btn {
    background: var(--color-text);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.8;
}

.timeline-header {
    display: flex;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 0.5rem;
}

.phase-labels {
    width: 200px;
    flex-shrink: 0;
    font-weight: 600;
    padding-right: 1rem;
}

.timeline-months {
    flex: 1;
    display: flex;
    border-bottom: 2px solid var(--color-border);
}

.month-label {
    padding: 0.5rem;
    font-weight: 600;
    color: var(--color-text);
    border-right: 1px solid var(--color-border);
}

.timeline-days {
    display: flex;
    margin-bottom: 0.5rem;
}

.timeline-days-header {
    display: flex;
    margin-bottom: 1rem;
}

.phase-label-placeholder {
    width: 200px;
    flex-shrink: 0;
}

.days-container {
    flex: 1;
    display: flex;
}

.day {
    width: var(--day-width);
    text-align: center;
    font-size: 0.75rem;
    padding: 0.25rem 0;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: white;
}

.day.weekend {
    background: var(--color-weekend);
}

.day.first-of-month {
    border-left: 2px solid var(--color-border);
}

.phase-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 3rem;
    position: relative;
}

.phase-main {
    display: flex;
    min-height: 100px;
}

.phase-name {
    width: 200px;
    flex-shrink: 0;
    padding-right: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-picker-wrapper {
    position: relative;
}

.color-input {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

.timeline-track {
    flex: 1;
    position: relative;
    height: 80px;
    background: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(var(--day-width) - 1px),
        var(--color-border) calc(var(--day-width) - 1px),
        var(--color-border) var(--day-width)
    );
}

.phase-bar-wrapper {
    position: absolute;
    top: 10%;
    height: 50px;
    cursor: move;
    z-index: 5;
}

.phase-bar-wrapper.dragging {
    opacity: 0.7;
    z-index: 100;
}

.phase-bar-wrapper.resizing {
    cursor: ew-resize;
    z-index: 100;
}

.phase-bar {
    height: 100%;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.phase-bar:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 10;
    transition: background 0.2s;
}

.resize-handle-left {
    left: 0;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.resize-handle-right {
    right: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.resize-handle:hover {
    background: rgba(0, 0, 0, 0.2);
}

.phase-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 0.85rem;
    color: white;
    font-weight: 500;
    pointer-events: none;
}

.phase-segments {
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    display: flex;
    gap: 2px;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.segment {
    padding: 2px 4px;
    background: rgba(0,0,0,0.05);
    border-radius: 2px;
    white-space: nowrap;
}

.milestone {
    position: absolute;
    top: 50%;
    transform: translate(50%, -50%);
    z-index: 10;
    cursor: move;
    user-select: none;
}

.milestone.dragging {
    z-index: 100;
    opacity: 0.8;
}

.milestone-marker {
    width: 16px;
    height: 16px;
    background: var(--color-milestone);
    transform: rotate(45deg);
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.milestone.final .milestone-marker {
    background: var(--color-final-milestone);
    width: 20px;
    height: 20px;
    border-width: 3px;
}

.milestone-label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-milestone);
    background: white;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--color-milestone);
}

.milestone.final .milestone-label {
    color: var(--color-final-milestone);
    border-color: var(--color-final-milestone);
    font-size: 0.8rem;
}

.milestone-date {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 0.75rem;
    background: var(--color-bg);
    font-weight: 600;
    border-bottom: 2px solid var(--color-border);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.phase-color-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

.risks {
    background: #fff9e6;
    border-left: 4px solid #f39c12;
}

.risks h2 {
    color: #d68910;
    margin-bottom: 1rem;
}

.risk-list {
    list-style: none;
    padding: 0;
}

.risk-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.risk-list li:before {
    content: "⚠";
    position: absolute;
    left: 0;
    color: #f39c12;
}

.legend {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-icon {
    width: 16px;
    height: 16px;
}

.legend-icon.milestone {
    background: var(--color-milestone);
    transform: rotate(45deg);
}

.legend-icon.final {
    background: var(--color-final-milestone);
    transform: rotate(45deg);
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    
    section {
        padding: 1rem;
    }
    
    .phase-name {
        width: 150px;
    }
    
    .phase-label-placeholder {
        width: 150px;
    }
    
    .day-marks-label {
        width: 150px;
    }
}
