.wfm-page-loader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 14%, rgba(47, 87, 138, 0.16), transparent 32%),
        radial-gradient(circle at 86% 80%, rgba(54, 173, 163, 0.16), transparent 34%),
        rgba(248, 250, 253, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2147483000;
}

.wfm-page-loader.is-active {
    display: flex !important;
}

.wfm-page-loader[aria-hidden="true"] {
    pointer-events: none;
}

body.wfm-loader-open {
    cursor: wait;
}

.wfm-loader-stage {
    position: relative;
    width: min(420px, calc(100vw - 48px));
    min-height: 168px;
    display: grid;
    grid-template-columns: 142px 1fr;
    grid-template-areas:
        "card route"
        "card copy";
    gap: 18px 20px;
    align-items: center;
    padding: 22px 24px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.95)),
        rgba(255, 255, 255, 0.88);
    box-shadow:
        0 28px 70px rgba(18, 19, 88, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.98);
    overflow: hidden;
}

.wfm-loader-stage::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #232F72 0%, #36ADA3 54%, #232F72 100%);
    background-size: 220% 100%;
    animation: wfm-loader-band 1.8s ease-in-out infinite;
}

.wfm-loader-card {
    grid-area: card;
    position: relative;
    min-height: 124px;
    padding: 14px;
    border: 1px solid rgba(47, 87, 138, 0.13);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 16px 32px rgba(35, 47, 114, 0.12);
    animation: wfm-card-lift 2.4s ease-in-out infinite;
}

.wfm-loader-card::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    width: 38px;
    height: 12px;
    border-radius: 8px 8px 5px 5px;
    background: #232F72;
    box-shadow: 0 4px 10px rgba(35, 47, 114, 0.18);
    transform: translateX(-50%);
}

.wfm-loader-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 0 13px;
}

.wfm-loader-card-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 28px;
    border-radius: 7px;
    background: #232F72;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.wfm-loader-card-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(54, 173, 163, 0.12);
    color: #16786f;
    font-size: 11px;
    font-weight: 800;
}

.wfm-loader-card-line {
    height: 8px;
    width: 68%;
    margin: 10px 0;
    border-radius: 999px;
    background: #e7eef6;
    overflow: hidden;
}

.wfm-loader-card-line.is-wide {
    width: 100%;
}

.wfm-loader-card-line::after {
    content: "";
    display: block;
    height: 100%;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(35, 47, 114, 0.9), rgba(54, 173, 163, 0.95));
    animation: wfm-card-line 1.8s ease-in-out infinite;
}

.wfm-loader-checklist {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.wfm-loader-checklist span {
    position: relative;
    height: 24px;
    border: 1px solid rgba(47, 87, 138, 0.14);
    border-radius: 7px;
    background: #f7f9fc;
}

.wfm-loader-checklist span::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 8px;
    width: 9px;
    height: 5px;
    border-left: 2px solid #36ADA3;
    border-bottom: 2px solid #36ADA3;
    opacity: 0;
    transform: rotate(-45deg) scale(0.8);
    animation: wfm-check 2.4s ease-in-out infinite;
}

.wfm-loader-checklist span:nth-child(2)::before {
    animation-delay: 0.28s;
}

.wfm-loader-checklist span:nth-child(3)::before {
    animation-delay: 0.56s;
}

.wfm-loader-route {
    grid-area: route;
    position: relative;
    display: grid;
    grid-template-columns: 14px 1fr 14px;
    align-items: center;
    min-height: 44px;
}

.wfm-loader-route-dot {
    width: 14px;
    height: 14px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #232F72;
    box-shadow:
        0 0 0 3px rgba(35, 47, 114, 0.12),
        0 8px 14px rgba(35, 47, 114, 0.16);
}

.wfm-loader-route-dot:last-of-type {
    background: #36ADA3;
    box-shadow:
        0 0 0 3px rgba(54, 173, 163, 0.16),
        0 8px 14px rgba(35, 47, 114, 0.14);
}

.wfm-loader-route-line {
    position: relative;
    height: 6px;
    margin: 0 7px;
    border-radius: 999px;
    background:
        repeating-linear-gradient(90deg, rgba(47, 87, 138, 0.18) 0 9px, transparent 9px 15px);
    overflow: hidden;
}

.wfm-loader-route-line span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 34%;
    border-radius: inherit;
    background: linear-gradient(90deg, #232F72, #36ADA3);
    animation: wfm-route-fill 2.2s ease-in-out infinite;
}

.wfm-loader-dispatch {
    position: absolute;
    top: 50%;
    left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 26px;
    border: 2px solid #ffffff;
    border-radius: 9px;
    background: #232F72;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 12px 18px rgba(35, 47, 114, 0.2);
    transform: translate(-4px, -50%);
    animation: wfm-dispatch 2.2s ease-in-out infinite;
}

.wfm-loader-copy {
    grid-area: copy;
    min-width: 0;
    color: #232F72;
}

.wfm-loader-copy strong {
    display: block;
    margin-bottom: 6px;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 900;
}

.wfm-loader-message {
    position: relative;
    display: block;
    min-height: 22px;
    color: #3d5d87;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 700;
}

.wfm-loader-message span {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateY(6px);
    animation: wfm-message 6.4s ease-in-out infinite;
}

.wfm-loader-message span:nth-child(2) {
    animation-delay: 1.6s;
}

.wfm-loader-message span:nth-child(3) {
    animation-delay: 3.2s;
}

.wfm-loader-message span:nth-child(4) {
    animation-delay: 4.8s;
}

.wfm-loader-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes wfm-loader-band {
    0%,
    100% {
        background-position: 0 0;
    }

    50% {
        background-position: 100% 0;
    }
}

@keyframes wfm-card-lift {
    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }

    50% {
        transform: translateY(-4px) rotate(1deg);
    }
}

@keyframes wfm-card-line {
    0%,
    100% {
        width: 36%;
    }

    50% {
        width: 82%;
    }
}

@keyframes wfm-check {
    0%,
    16% {
        opacity: 0;
        transform: rotate(-45deg) scale(0.8);
    }

    28%,
    78% {
        opacity: 1;
        transform: rotate(-45deg) scale(1);
    }

    100% {
        opacity: 0;
        transform: rotate(-45deg) scale(0.8);
    }
}

@keyframes wfm-route-fill {
    0%,
    100% {
        width: 18%;
    }

    58% {
        width: 82%;
    }
}

@keyframes wfm-dispatch {
    0%,
    100% {
        left: 0;
        transform: translate(-4px, -50%) scale(0.96);
    }

    58% {
        left: calc(100% - 34px);
        transform: translate(4px, -50%) scale(1.03);
    }
}

@keyframes wfm-message {
    0%,
    8% {
        opacity: 0;
        transform: translateY(6px);
    }

    12%,
    23% {
        opacity: 1;
        transform: translateY(0);
    }

    28%,
    100% {
        opacity: 0;
        transform: translateY(-6px);
    }
}

@media (max-width: 620px) {
    .wfm-loader-stage {
        width: min(330px, calc(100vw - 32px));
        grid-template-columns: 1fr;
        grid-template-areas:
            "card"
            "route"
            "copy";
        gap: 14px;
        padding: 18px;
        border-radius: 15px;
    }

    .wfm-loader-card {
        min-height: 112px;
    }

    .wfm-loader-copy strong {
        font-size: 16px;
    }

    .wfm-loader-message {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wfm-loader-stage::before,
    .wfm-loader-card,
    .wfm-loader-card-line::after,
    .wfm-loader-checklist span::before,
    .wfm-loader-route-line span,
    .wfm-loader-dispatch,
    .wfm-loader-message span {
        animation: none;
    }

    .wfm-loader-card-line::after,
    .wfm-loader-route-line span {
        width: 72%;
    }

    .wfm-loader-checklist span::before,
    .wfm-loader-message span:first-child {
        opacity: 1;
        transform: none;
    }

    .wfm-loader-dispatch {
        left: calc(100% - 34px);
        transform: translate(4px, -50%);
    }
}

@media print {
    .wfm-page-loader {
        display: none !important;
    }
}
