.pipeline-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.pipeline-subhead {
    margin: 0;
    color: #8a867e;
    font-size: 0.9rem;
}

.pipeline-head-side {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pipeline-overdue-total {
    padding: 4px 11px;
    border-radius: 10px;
    background: #fdf6e7;
    border: 1px solid #ecd9a8;
    color: #6b5420;
    font-size: 0.85rem;
    font-weight: 600;
}

.pipeline-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

@media (max-width: 991px) {
    .pipeline-board {
        grid-template-columns: minmax(0, 1fr);
    }
}

.pipeline-stage {
    display: flex;
    flex-direction: column;
    /* A stage never runs past the bottom of the screen: once its queue is that
       long the column scrolls on its own, so the other stages stay reachable.
       The offset covers the fixed nav and the board heading above it. */
    max-height: calc(100vh - var(--app-navbar-height) - 155px);
    padding: 14px;
    border: 1px solid #e0dcd4;
    border-radius: 10px;
    background: #f9f8f6;
}

.pipeline-stage-head {
    flex: 0 0 auto;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0dcd4;
}

.pipeline-stage-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    font-size: 1.05rem;
}

.pipeline-stage-count {
    padding: 1px 9px;
    border-radius: 10px;
    background: #efece7;
    color: #6f6b64;
    font-size: 0.82rem;
    font-weight: 600;
}

.pipeline-stage-note {
    margin: 4px 0 0;
    color: #8a867e;
    font-size: 0.85rem;
}

.pipeline-stage-overdue {
    margin: 7px 0 0;
    color: #6b5420;
    font-size: 0.85rem;
    font-weight: 600;
}

.pipeline-stage-empty {
    margin: 14px 0 0;
    color: #b3ada3;
    font-style: italic;
}

.pipeline-cards {
    list-style: none;
    margin: 14px 0 0;
    /* Room for the scrollbar so it never sits on top of a card. */
    padding: 0 5px 0 0;
    display: grid;
    gap: 12px;
    align-content: start;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pipeline-card {
    padding: 12px 14px;
    border: 1px solid #e0dcd4;
    border-left: 3px solid #c9c4ba;
    border-radius: 8px;
    background: #fff;
    color: #3e3f3a;
}

.pipeline-card.is-overdue {
    border-left-color: #d9a441;
}

.pipeline-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.pipeline-card-name {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.pipeline-card-name:hover {
    text-decoration: underline;
}

.pipeline-card-age {
    color: #8a867e;
    font-size: 0.82rem;
    white-space: nowrap;
}

.pipeline-card-age.is-overdue {
    color: #6b5420;
    font-weight: 600;
}

.pipeline-card-client {
    margin: 3px 0 0;
    color: #8a867e;
    font-size: 0.87rem;
}

.pipeline-card-client-link {
    color: inherit;
    text-decoration: none;
}

.pipeline-card-client-link:hover {
    text-decoration: underline;
}

.pipeline-card-sep {
    margin: 0 5px;
    color: #c2bcb1;
}

.pipeline-card-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 11px 0 0;
}

.pipeline-card-facts dt {
    color: #8a867e;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.pipeline-card-facts dd {
    margin: 2px 0 0;
    font-size: 0.88rem;
}

.pipeline-card-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 11px 0 0;
    padding-top: 9px;
    border-top: 1px solid #efece7;
    color: #8a867e;
    font-size: 0.85rem;
}

/* Stacked on a narrow screen the stages follow each other down the page, so
   capping them would only nest one scroll inside another. Last in the file so
   it wins over the rules above, which carry the same specificity. */
@media (max-width: 991px) {
    .pipeline-stage {
        max-height: none;
    }

    .pipeline-cards {
        padding-right: 0;
        overflow-y: visible;
    }
}
