: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: 60px;
    --member-column-width: 160px;
}

* {
    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%);
}

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

.workforce-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;
}

/* Member panel */
.member-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    margin-bottom: 24px;
}

.member-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.member-selection-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.section-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
    margin-bottom: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.member-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-checkbox-label {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.member-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(47, 125, 87, 0.4);
}

.member-checkbox-label input {
    cursor: pointer;
}

.member-role-tag {
    font-size: 11px;
    color: var(--muted);
    background: rgba(22, 32, 26, 0.06);
    padding: 1px 6px;
    border-radius: 999px;
}

/* Groups */
.group-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.4);
}

.group-item-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.group-name-label {
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.group-member-count {
    font-size: 12px;
    color: var(--muted);
}

.group-item-actions {
    display: flex;
    gap: 8px;
}

.empty-groups {
    font-size: 13px;
    color: var(--muted);
    padding: 8px 0;
}

/* Buttons */
.ghost-button {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 252, 243, 0.72);
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.ghost-button:hover {
    background: rgba(255, 255, 255, 0.9);
}

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

.ghost-button.danger {
    color: #b42318;
    border-color: rgba(180, 35, 24, 0.3);
}

.ghost-button.danger:hover {
    background: rgba(180, 35, 24, 0.06);
}

.primary-button {
    padding: 8px 20px;
    border: none;
    border-radius: 999px;
    background: #2f7d57;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.primary-button:hover {
    background: #256647;
}

/* Workforce / Gantt board */
.workforce-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

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

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

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

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

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

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

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

.workforce-board {
    overflow-x: auto;
    border: 1px solid rgba(22, 32, 26, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.36);
    cursor: grab;
    user-select: none;
}

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

/* Gantt grid (shared structure with gantt page) */
.gantt-grid {
    min-width: max(720px, calc(var(--member-column-width) + var(--timeline-width)));
}

.gantt-row {
    display: grid;
    grid-template-columns: var(--member-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);
}

.member-cell {
    position: sticky;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    padding: 14px;
    border-right: 1px solid rgba(22, 32, 26, 0.1);
    background: rgba(255, 252, 243, 0.96);
    font-size: 15px;
    font-weight: 900;
    word-break: break-all;
}

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

.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);
    padding: 10px 4px;
    border-left: 1px solid rgba(22, 32, 26, 0.08);
    color: var(--muted);
    font-size: 13px;
    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: 11px;
    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;
    display: flex;
    align-items: center;
    min-width: 16px;
    height: 26px;
    overflow: hidden;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(22, 32, 26, 0.14);
    opacity: 0.85;
}

.phase-bar-label {
    min-width: 0;
    padding: 0 10px;
    overflow: hidden;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 26px;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(22, 32, 26, 0.35);
    white-space: nowrap;
}

.phase-bar.pm {
    background: linear-gradient(90deg, #9a5c17, #d49a4d);
    top: calc(50% - 22px);
}

.phase-bar.rd {
    background: linear-gradient(90deg, #2f7d57, #65a47e);
    top: calc(50% + 3px);
}

.phase-bar.qa {
    background: linear-gradient(90deg, #1677ff, #70a9ff);
    top: calc(50% - 10px);
}

.no-data {
    position: absolute;
    left: 10px;
    color: rgba(22, 32, 26, 0.3);
    font-size: 12px;
    font-style: italic;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(22, 32, 26, 0.42);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.is-open {
    display: flex;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    border-radius: 24px;
    background: #fffcf3;
    box-shadow: 0 40px 100px rgba(22, 32, 26, 0.24);
}

.modal-card h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 800;
    line-height: 1.1;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: rgba(22, 32, 26, 0.08);
    color: var(--ink);
    font-size: 18px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
}

.text-input {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.text-input:focus {
    border-color: rgba(47, 125, 87, 0.5);
}

.group-member-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 10px 20px;
    border-radius: 999px;
    background: rgba(22, 32, 26, 0.88);
    color: #fffcf3;
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
    z-index: 200;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

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

    .member-selection-area {
        grid-template-columns: 1fr;
    }

    .gantt-grid {
        --member-column-width: 110px;
    }
}
