.project-plan-stack {
    display: grid;
    gap: 1rem;
}

.employee-content:has(.project-workspace-layout) {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.25rem 1rem 3rem;
    box-sizing: border-box;
}

.project-tabs {
    display: flex;
    align-items: center;
    gap: .35rem;
    overflow-x: auto;
    padding: .35rem;
    background: #e9eef6;
    border: 1px solid #d8e1ed;
    border-radius: 12px;
}

.project-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-width: 104px;
    padding: .62rem .9rem;
    color: #536177;
    font-size: .84rem;
    font-weight: 650;
    white-space: nowrap;
    background: transparent;
    border: 0;
    border-radius: 9px;
}

.project-tab:hover {
    color: #1d4ed8;
    background: rgba(255, 255, 255, .7);
}

.project-tab.active {
    color: #1d4ed8;
    background: #fff;
    box-shadow: 0 2px 8px rgba(23, 59, 103, .1);
}

.project-workspace-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: .8rem;
    align-items: start;
}

.project-summary-rail {
    position: sticky;
    top: calc(var(--pv-topbar) + 1rem);
    display: grid;
    gap: .8rem;
}

.project-summary-rail .project-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .8rem;
    margin-bottom: 0 !important;
}

.project-summary-rail .metric-card {
    min-height: 118px;
    padding: 1rem 1.05rem;
}

.project-summary-rail .metric-card .metric-value {
    margin-top: .35rem;
    font-size: 1.08rem !important;
}

.project-summary-rail .metric-card small {
    display: block;
    margin-top: .3rem;
    color: #5b6575;
}

.project-lifecycle {
    margin: 0;
}

.project-workspace-main {
    min-width: 0;
}

.plan-toolbar {
    border-color: #d4deec;
    box-shadow: 0 3px 12px rgba(23, 59, 103, .04);
}

.milestone-group {
    overflow: hidden;
    border: 1px solid #d5dfed;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(23, 59, 103, .055);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.milestone-group:hover {
    border-color: #b9c9df;
    box-shadow: 0 8px 24px rgba(23, 59, 103, .09);
}

.milestone-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 94px;
    padding: 1rem 1.15rem;
    background: linear-gradient(105deg, #f5f9ff 0%, #fff 62%);
    border-bottom: 1px solid #e4eaf2;
}

.milestone-header::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #2563eb, #60a5fa);
    content: "";
}

.milestone-toggle {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-width: 300px;
    flex: 1;
    padding: 0;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
}

.milestone-chevron {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    color: #63738a;
    background: #e7eef8;
    border-radius: 50%;
}

.milestone-marker {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    color: #fff;
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    border-radius: 13px;
    box-shadow: 0 7px 16px rgba(37, 99, 235, .22);
}

.milestone-marker span {
    font-size: .65rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .08em;
}

.milestone-marker i {
    margin-top: 3px;
    font-size: .9rem;
    line-height: 1;
}

.milestone-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .25rem;
}

.milestone-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .55rem;
}

.milestone-title-row strong {
    color: #173b67;
    font-size: 1rem;
    font-weight: 760;
}

.milestone-state {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .48rem;
    font-size: .67rem;
    font-weight: 750;
    border-radius: 999px;
}

.milestone-state.on-track { color: #1d4ed8; background: #e8f0ff; }
.milestone-state.completed { color: #166534; background: #dcfce7; }
.milestone-state.overdue { color: #b91c1c; background: #fee2e2; }

.milestone-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .9rem;
    color: #5b6575;
    font-size: .75rem;
    font-weight: 550;
}

.milestone-meta span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.milestone-description {
    max-width: 620px;
    overflow: hidden;
    color: #536177;
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.milestone-progress {
    width: min(190px, 17vw);
    flex: 0 0 auto;
}

.milestone-progress .d-flex {
    color: #5b6575;
    font-size: .7rem;
}

.milestone-progress strong {
    color: #173b67;
    font-size: .75rem;
}

.milestone-progress .progress {
    height: 7px;
    margin-top: .35rem;
    background: #e7edf5;
}

.milestone-progress .progress-bar {
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    border-radius: 999px;
}

.milestone-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: .35rem;
}

.milestone-actions .btn-light {
    color: #43506a;
    background: #fff;
    border-color: #dce4ef;
}

.milestone-group.unassigned {
    border-style: dashed;
    box-shadow: none;
}

.milestone-group.unassigned .milestone-header {
    min-height: 76px;
    background: #fbfcfe;
}

.milestone-group.unassigned .milestone-header::before { background: #94a3b8; }

.milestone-group.unassigned .milestone-marker {
    width: 44px;
    height: 44px;
    color: #64748b;
    background: #e9eef5;
    box-shadow: none;
}

.milestone-group .incident-table thead th { background: #f8fafc; }
.milestone-group .incident-table tbody tr:hover { background: #f8fbff; }
.task-description { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-task-titles { min-height: 180px; }

.project-plan-modal .modal-dialog {
    width: min(calc(100% - 2rem), 1140px);
    margin-inline: auto;
}

.project-plan-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.project-plan-modal .modal-header {
    padding: 1rem 1.25rem;
    background: #f8faff;
    border-bottom-color: #e3e9f2;
}

.project-plan-modal .modal-body {
    max-height: calc(100vh - 220px);
    padding: 1.25rem;
    overflow-y: auto;
}

.project-plan-modal .modal-footer {
    padding: .85rem 1.25rem;
    background: #fafbfd;
    border-top-color: #e3e9f2;
}

.project-plan-modal textarea.form-control:not(.bulk-task-titles) { min-height: 110px; }

@media (max-width: 700px) {
    .milestone-header { align-items: flex-start; flex-wrap: wrap; padding: .9rem; }
    .milestone-toggle { min-width: 100%; }
    .milestone-marker { width: 44px; height: 44px; }
    .milestone-progress { order: 3; width: 100%; padding-left: 34px; }
    .milestone-actions { order: 4; width: 100%; justify-content: flex-end; }
    .milestone-description { max-width: 62vw; }
}

@media (max-width: 1000px) {
    .employee-content:has(.project-workspace-layout) { padding-inline: .8rem; }
    .project-workspace-layout { grid-template-columns: 1fr; }
    .project-summary-rail { position: static; grid-template-columns: 1fr; }
    .project-summary-rail .project-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .project-lifecycle .d-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .employee-content:has(.project-workspace-layout) { padding-inline: .55rem; }
    .project-tabs { margin-inline: -.25rem; border-radius: 9px; }
    .project-tab { min-width: 90px; padding: .58rem .7rem; }
    .project-summary-rail .project-hero-grid { grid-template-columns: 1fr; }
    .project-lifecycle .d-grid { grid-template-columns: 1fr; }
    .project-plan-modal .modal-dialog { width: calc(100% - 1rem); margin: .5rem auto; }
    .project-plan-modal .modal-body { max-height: calc(100vh - 170px); padding: 1rem; }
}
