/* Shipment dashboard and cross-feature shipment states */
.shipment-summary-grid {
    margin-bottom: 1.25rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.shipment-summary-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.shipment-summary-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 0.3rem;
    background: #9b948d;
}

.shipment-summary-card:hover {
    color: var(--ink);
    border-color: rgba(135, 33, 63, 0.25);
    box-shadow: 0 21px 60px rgba(50, 39, 31, 0.14);
    transform: translateY(-2px);
}

.shipment-summary-card.moving::before { background: #3c7697; }
.shipment-summary-card.delivered::before { background: var(--leaf); }
.shipment-summary-card.waiting::before { background: var(--gold); }
.shipment-summary-card.attention::before { background: var(--wine); }

.shipment-summary-card > span {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.065em;
    text-transform: uppercase;
}

.shipment-summary-card strong {
    margin: 0.25rem 0 0.1rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 400;
}

.shipment-summary-card small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.67rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shipment-analysis-note {
    margin-bottom: 1.25rem;
    padding: 1rem 1.2rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

.shipment-analysis-icon {
    width: 2.6rem;
    height: 2.6rem;
    display: grid;
    place-items: center;
    color: var(--wine);
    background: var(--wine-soft);
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 900;
}

.shipment-analysis-note > div {
    display: flex;
    flex-direction: column;
}

.shipment-analysis-note strong {
    font-size: 0.86rem;
}

.shipment-analysis-note span:not(.shipment-analysis-icon) {
    color: var(--muted);
    font-size: 0.72rem;
}

.shipment-analysis-note > a,
.card-header-link {
    color: var(--wine);
    font-size: 0.72rem;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
}

.shipment-filter {
    overflow-x: auto;
}

.shipment-list-card {
    padding: 1.35rem;
}

.shipment-list {
    display: grid;
}

.shipment-row {
    min-width: 0;
    padding: 1rem 0.2rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    border-bottom: 1px solid #eee9e2;
}

.shipment-row:last-child {
    border-bottom: 0;
}

.shipment-row-state {
    width: 2.3rem;
    height: 2.3rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 0.86rem;
    font-weight: 900;
}

.shipment-row-state.delivered,
.shipment-timeline-marker.delivered { color: #466c2e; background: var(--leaf-soft); }
.shipment-row-state.moving,
.shipment-row-state.out-for-delivery,
.shipment-timeline-marker.moving,
.shipment-timeline-marker.out-for-delivery { color: #285f80; background: #e8f2f7; }
.shipment-row-state.preparing,
.shipment-timeline-marker.preparing { color: #806127; background: var(--gold-soft); }
.shipment-row-state.attention,
.shipment-timeline-marker.attention { color: var(--wine); background: var(--wine-soft); }
.shipment-row-state.unknown,
.shipment-row-state.waiting,
.shipment-timeline-marker.unknown { color: #686159; background: #efebe6; }

.shipment-row-main {
    min-width: 0;
}

.shipment-row-title {
    overflow: hidden;
    display: block;
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 820;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shipment-row-title:hover {
    color: var(--wine);
}

.shipment-row-meta,
.shipment-event-facts {
    margin-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.85rem;
    color: var(--muted);
    font-size: 0.66rem;
}

.shipment-row-meta span,
.shipment-event-facts span {
    position: relative;
}

.shipment-row-meta span + span::before,
.shipment-event-facts span + span::before {
    content: "·";
    position: absolute;
    left: -0.55rem;
    color: #b5aea6;
}

.shipment-diagnostic {
    margin-top: 0.3rem;
    display: block;
    color: #82632d;
    font-size: 0.65rem;
}

.shipment-row-status {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 0.35rem;
}

.shipment-row-status time,
.order-shipment-event time {
    color: var(--muted);
    font-size: 0.64rem;
    white-space: nowrap;
}

.shipment-status-badge {
    max-width: 14rem;
    padding: 0.28rem 0.55rem;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.61rem;
    font-weight: 850;
    line-height: 1.2;
    text-align: center;
}

.shipment-status-badge.delivered { color: #466c2e; background: var(--leaf-soft); border-color: #d4e5c8; }
.shipment-status-badge.moving,
.shipment-status-badge.out-for-delivery { color: #285f80; background: #e8f2f7; border-color: #c9e1ed; }
.shipment-status-badge.preparing { color: #806127; background: var(--gold-soft); border-color: #e9d8b5; }
.shipment-status-badge.attention { color: var(--wine); background: var(--wine-soft); border-color: #efccd7; }
.shipment-status-badge.unknown,
.shipment-status-badge.waiting { color: #686159; background: #efebe6; border-color: #ded7cf; }

/* Links from mails and orders */
.mail-shipment-link,
.mail-order-link {
    width: fit-content;
    margin-top: 0.32rem;
    padding: 0.18rem 0.48rem;
    display: inline-flex;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 850;
    text-decoration: none;
}

.mail-shipment-link {
    margin-left: 0.25rem;
    color: #285f80;
    background: #e8f2f7;
}

.mail-shipment-link.unresolved {
    color: #806127;
    background: var(--gold-soft);
}

.mail-shipment-carrier {
    margin-top: 0.35rem;
    display: block;
    color: var(--muted);
}

.order-shipment-link {
    min-width: 8rem;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
}

.order-shipment-link small {
    max-width: 12rem;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.58rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-shipment-banner {
    margin-bottom: 1.25rem;
    padding: 0.95rem 1.1rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    color: #285f80;
    background: linear-gradient(90deg, #e8f2f7, #f7fbfc);
    border: 1px solid #c9e1ed;
    border-radius: 0.75rem;
    text-decoration: none;
}

.order-shipment-banner.delivered {
    color: #466c2e;
    background: linear-gradient(90deg, var(--leaf-soft), #f8fbf5);
    border-color: #d4e5c8;
}

.order-shipment-banner.attention {
    color: var(--wine);
    background: linear-gradient(90deg, var(--wine-soft), #fff9fb);
    border-color: #efccd7;
}

.order-shipment-banner.preparing,
.order-shipment-banner.waiting {
    color: #806127;
    background: linear-gradient(90deg, var(--gold-soft), #fffdf8);
    border-color: #e9d8b5;
}

.order-shipment-banner:hover {
    color: inherit;
    box-shadow: 0 10px 30px rgba(50, 39, 31, 0.08);
}

.order-shipment-icon {
    width: 2.3rem;
    height: 2.3rem;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 50%;
    font-weight: 900;
}

.order-shipment-banner > div {
    display: flex;
    flex-direction: column;
}

.order-shipment-banner strong {
    font-size: 0.84rem;
}

.order-shipment-banner small,
.order-shipment-banner > span:last-child {
    font-size: 0.66rem;
}

.order-shipment-events {
    display: grid;
}

.order-shipment-event {
    min-width: 0;
    padding: 0.85rem 0.15rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    color: var(--ink);
    border-bottom: 1px solid #eee9e2;
    text-decoration: none;
}

.order-shipment-event:last-child {
    border-bottom: 0;
}

.order-shipment-event > span:nth-child(2) {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.order-shipment-event strong,
.order-shipment-event small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-shipment-event strong { font-size: 0.76rem; }
.order-shipment-event small { color: var(--muted); font-size: 0.64rem; }

.shipment-event-dot {
    width: 0.65rem;
    height: 0.65rem;
    display: block;
    background: #9b948d;
    border-radius: 50%;
    box-shadow: 0 0 0 4px #efebe6;
}

.shipment-event-dot.delivered { background: var(--leaf); box-shadow: 0 0 0 4px var(--leaf-soft); }
.shipment-event-dot.moving,
.shipment-event-dot.out-for-delivery { background: #3c7697; box-shadow: 0 0 0 4px #e8f2f7; }
.shipment-event-dot.preparing { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.shipment-event-dot.attention { background: var(--wine); box-shadow: 0 0 0 4px var(--wine-soft); }

/* Shipment detail */
.shipment-detail-heading {
    align-items: flex-end;
}

.shipment-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.shipment-attention-banner {
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--wine);
    background: var(--wine-soft);
    border: 1px solid #efccd7;
    border-radius: 0.75rem;
}

.shipment-attention-banner > span {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--wine);
    border-radius: 50%;
    font-weight: 900;
}

.shipment-attention-banner > div {
    display: flex;
    flex-direction: column;
}

.shipment-attention-banner small {
    font-size: 0.68rem;
}

.shipment-progress-card {
    margin-bottom: 1.25rem;
    padding: 1.15rem 1.4rem;
    display: grid;
    grid-template-columns: auto minmax(1rem, 1fr) auto minmax(1rem, 1fr) auto minmax(1rem, 1fr) auto minmax(1rem, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
}

.shipment-progress-step {
    min-width: 4rem;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 0.35rem;
    color: #aaa29a;
    font-size: 0.62rem;
}

.shipment-progress-step span {
    width: 1.85rem;
    height: 1.85rem;
    display: grid;
    place-items: center;
    color: #8e867e;
    background: #efebe6;
    border-radius: 50%;
    font-weight: 900;
}

.shipment-progress-step.reached {
    color: var(--ink);
}

.shipment-progress-step.reached span {
    color: #fff;
    background: var(--wine);
    box-shadow: 0 0 0 4px var(--wine-soft);
}

.shipment-progress-line {
    height: 2px;
    background: #e6e0d9;
}

.shipment-progress-line.reached {
    background: var(--wine);
}

.shipment-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(17rem, 0.65fr);
    gap: 1.25rem;
    align-items: start;
}

.shipment-timeline-card,
.shipment-facts-card {
    padding: 1.35rem;
}

.shipment-detail-side {
    display: grid;
    gap: 1.25rem;
}

.shipment-timeline {
    position: relative;
    display: grid;
}

.shipment-timeline-event {
    position: relative;
    padding: 1rem 0.15rem;
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr);
    gap: 0.75rem;
}

.shipment-timeline-event:not(:last-child)::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: 2.15rem;
    bottom: -0.15rem;
    left: 0.86rem;
    width: 1px;
    background: #ddd6ce;
}

.shipment-timeline-marker {
    position: relative;
    z-index: 1;
    width: 1.5rem;
    height: 1.5rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.shipment-timeline-marker span {
    width: 0.48rem;
    height: 0.48rem;
    background: currentColor;
    border-radius: 50%;
}

.shipment-timeline-copy {
    min-width: 0;
}

.shipment-timeline-copy > div:first-child {
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.shipment-timeline-copy time {
    color: var(--muted);
    font-size: 0.64rem;
    white-space: nowrap;
}

.shipment-timeline-copy > a {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
}

.shipment-timeline-copy > a:hover {
    color: var(--wine);
}

.shipment-timeline-copy > p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.68rem;
}

.shipment-facts-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
}

.shipment-track-button,
.shipment-order-button {
    width: 100%;
    margin-top: 1rem;
}

@media (max-width: 1050px) {
    .shipment-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .shipment-detail-grid {
        grid-template-columns: 1fr;
    }

    .shipment-progress-card {
        padding: 1rem;
        grid-template-columns: repeat(5, minmax(3.2rem, 1fr));
        overflow-x: auto;
    }

    .shipment-progress-line {
        display: none;
    }
}

@media (max-width: 620px) {
    .shipment-summary-grid {
        grid-template-columns: 1fr;
    }

    .shipment-analysis-note {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .shipment-analysis-note > a {
        grid-column: 2;
    }

    .shipment-row {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .shipment-row-status {
        grid-column: 2;
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .shipment-heading-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .shipment-progress-card {
        grid-template-columns: repeat(5, minmax(4.2rem, 1fr));
    }

    .order-shipment-banner {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .order-shipment-banner > span:last-child {
        display: none;
    }

    .order-shipment-event {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .order-shipment-event time {
        grid-column: 2;
    }
}
