:root {
    --ink: #16201a;
    --muted: #647066;
    --panel: rgba(255, 252, 243, 0.86);
    --line: rgba(22, 32, 26, 0.14);
    --shadow: 0 30px 80px rgba(45, 54, 44, 0.16);
    --day-width: 64px;
    --project-column-width: 220px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    background:
        radial-gradient(circle at 18% 10%, rgba(255, 184, 77, 0.2), transparent 30%),
        radial-gradient(circle at 90% 18%, rgba(79, 140, 255, 0.18), transparent 32%),
        linear-gradient(135deg, #f7f0e3 0%, #edf3e8 100%);
}

body::before {
    position: fixed;
    inset: 0;
    pointer-events: none;
    content: "";
    background-image:
        linear-gradient(rgba(22, 32, 26, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 32, 26, 0.05) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 82%);
}

.gantt-shell {
    position: relative;
    width: min(1400px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px 0 72px;
}

.gantt-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 28px;
    align-items: center;
    margin-bottom: 32px;
}

.header-left {
    justify-self: start;
}

.header-title {
    justify-self: center;
    text-align: center;
}

.header-actions {
    justify-self: end;
}

h1,
h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

h1 {
    font-size: 1.8em;
    font-weight: 800;
    line-height: 1.1;
}

.back-link {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    color: #9a5c17;
    border: 1px solid #9a5c17;
    border-radius: 999px;
    background: rgba(255, 252, 243, 0.72);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.gantt-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.gantt-title-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 18px;
}

.gantt-title-main {
    justify-self: start;
}

.gantt-title-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
}

.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    justify-self: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.gantt-legend span {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.legend-dot.dev {
    background: #2f7d57;
}

.legend-dot.debug {
    background: #1677ff;
}

.legend-dot.test {
    background: #9a5c17;
}

.legend-dot.launch {
    background: #b42318;
}

.display-toggle {
    position: relative;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.display-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.display-toggle i {
    position: relative;
    width: 42px;
    height: 24px;
    border: 1px solid rgba(22, 32, 26, 0.18);
    border-radius: 999px;
    background: rgba(22, 32, 26, 0.14);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.display-toggle i::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(22, 32, 26, 0.18);
    content: "";
    transition: transform 0.2s ease;
}

.display-toggle input:checked + i {
    border-color: rgba(47, 125, 87, 0.42);
    background: #2f7d57;
}

.display-toggle input:checked + i::after {
    transform: translateX(18px);
}

.gantt-board {
    overflow-x: auto;
    border: 1px solid rgba(22, 32, 26, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.36);
}

.gantt-empty {
    padding: 48px 20px;
    color: rgba(22, 32, 26, 0.48);
    font-weight: 800;
    text-align: center;
}

.gantt-grid {
    min-width: max(980px, calc(var(--project-column-width) + var(--timeline-width)));
}

.gantt-row {
    display: grid;
    grid-template-columns: var(--project-column-width) var(--timeline-width);
    min-height: 62px;
    border-bottom: 1px solid rgba(22, 32, 26, 0.08);
}

.gantt-row:last-child {
    border-bottom: 0;
}

.gantt-row.header-row {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 46px;
    background: rgba(255, 252, 243, 0.96);
}

.project-cell,
.date-cell {
    padding: 14px;
}

.project-cell {
    position: sticky;
    left: 0;
    z-index: 1;
    border: 0;
    border-right: 1px solid rgba(22, 32, 26, 0.1);
    color: inherit;
    background: rgba(255, 252, 243, 0.96);
    font: inherit;
    text-align: left;
}

.project-cell-button {
    cursor: pointer;
}

.project-cell-button:hover .project-name {
    color: #9a5c17;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.header-row .project-cell {
    z-index: 3;
    font-size: 18px;
    font-weight: 900;
}

.project-name {
    display: block;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.4;
    word-break: break-all;
}

.project-range {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.timeline-header,
.timeline-track {
    display: grid;
    grid-template-columns: repeat(var(--day-count), var(--day-width));
}

.timeline-header {
    align-items: stretch;
}

.date-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    justify-content: center;
    min-width: var(--day-width);
    border-left: 1px solid rgba(22, 32, 26, 0.08);
    color: var(--muted);
    font-size: 16px;
    font-weight: 900;
    text-align: center;
}

.date-cell.weekend,
.date-cell.holiday-break,
.date-cell.holiday {
    background: rgba(22, 32, 26, 0.04);
}

.date-cell.holiday {
    color: #b42318;
}

.date-note {
    font-size: 12px;
    line-height: 1;
}

.timeline-track {
    min-height: 62px;
}

.timeline-track.is-bar-mode {
    position: relative;
    align-items: center;
    background-image:
        repeating-linear-gradient(
            to right,
            rgba(22, 32, 26, 0.08) 0,
            rgba(22, 32, 26, 0.08) 1px,
            transparent 1px,
            transparent var(--day-width)
        );
}

.phase-bar {
    position: absolute;
    top: 18px;
    height: 26px;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(22, 32, 26, 0.14);
}

.phase-bar.dev {
    background: linear-gradient(90deg, #2f7d57, #65a47e);
}

.phase-bar.debug {
    background: linear-gradient(90deg, #1677ff, #70a9ff);
}

.phase-bar.test {
    background: linear-gradient(90deg, #9a5c17, #d49a4d);
}

.phase-dot {
    position: absolute;
    top: 20px;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 252, 243, 0.96);
    border-radius: 999px;
    background: #b42318;
    box-shadow: 0 8px 18px rgba(22, 32, 26, 0.18);
}

.timeline-cell {
    position: relative;
    min-width: var(--day-width);
    min-height: 62px;
    border-left: 1px solid rgba(22, 32, 26, 0.08);
}

.timeline-cell.phase-dev {
    background: rgba(47, 125, 87, 0.32);
}

.timeline-cell.phase-debug {
    background: rgba(22, 119, 255, 0.28);
}

.timeline-cell.phase-test {
    background: rgba(154, 92, 23, 0.3);
}

.timeline-cell.phase-launch {
    background: rgba(180, 35, 24, 0.16);
}

.launch-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 252, 243, 0.96);
    border-radius: 999px;
    background: #b42318;
    box-shadow: 0 8px 18px rgba(22, 32, 26, 0.18);
    transform: translate(-50%, -50%);
}

@media (max-width: 820px) {
    .gantt-shell {
        width: min(100% - 24px, 1380px);
        padding-top: 28px;
    }

    .gantt-header {
        grid-template-columns: auto 1fr auto;
        gap: 14px;
    }

    .gantt-title-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .gantt-legend,
    .gantt-title-actions {
        justify-self: start;
    }

    .gantt-grid {
        --project-column-width: 170px;
    }
}
