.wf-tool {
    margin-top: 0.75rem;
    overflow: hidden;
    border: 1px solid #cfdad6;
    border-radius: 8px;
    background: #fff;
}

.wf-tool [hidden] {
    display: none !important;
}

.wf-tool__disclosure > summary {
    display: grid;
    min-height: 58px;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1.25rem;
    color: #263a33;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.wf-tool__disclosure > summary::-webkit-details-marker {
    display: none;
}

.wf-tool__disclosure > summary:hover,
.wf-tool__disclosure > summary:focus-visible {
    background: #f4f7f6;
    outline: none;
}

.wf-tool__disclosure > summary > .material-icons:first-child {
    color: #28775f;
    font-size: 1.15rem;
}

.wf-tool__summary-detail {
    color: #74817d;
    font-size: 0.78rem;
    font-weight: 400;
}

.wf-tool__chevron {
    color: #64756f;
    font-size: 1.2rem;
    transition: transform 160ms ease;
}

.wf-tool__disclosure[open] .wf-tool__chevron {
    transform: rotate(180deg);
}

.wf-tool__body {
    padding: 1.1rem 1.25rem 1.25rem;
    border-top: 1px solid #dce5e2;
}

.wf-tool__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.5rem;
    margin-bottom: 1rem;
}

.wf-segmented {
    display: flex;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.wf-segmented legend {
    margin-right: 0.55rem;
    color: #61726c;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 36px;
}

.wf-segmented label {
    position: relative;
    margin: 0;
}

.wf-segmented input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.wf-segmented span {
    display: flex;
    min-height: 36px;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border: 1px solid #cbd7d3;
    color: #52645e;
    background: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.wf-segmented label:first-of-type span {
    border-radius: 6px 0 0 6px;
}

.wf-segmented label:last-of-type span {
    margin-left: -1px;
    border-radius: 0 6px 6px 0;
}

.wf-segmented input:checked + span {
    position: relative;
    z-index: 1;
    color: #1f624e;
    border-color: #5b9683;
    background: #edf6f2;
}

.wf-segmented input:focus-visible + span {
    outline: 3px solid rgba(40, 119, 95, 0.18);
    outline-offset: 1px;
}

.wf-tool__state {
    display: flex;
    min-height: 94px;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 1rem;
    border: 1px dashed #cfdbd7;
    border-radius: 6px;
    color: #687873;
    background: #fbfcfc;
    text-align: center;
}

.wf-tool__state p {
    margin: 0;
    font-size: 0.84rem;
}

.wf-tool__state-copy {
    min-width: 0;
}

.wf-tool__state-copy small {
    display: block;
    margin-top: 0.2rem;
    color: #788680;
    font-size: 0.72rem;
}

.wf-tool__state > .material-icons {
    color: #789089;
    font-size: 1.15rem;
}

.wf-tool__state--warning {
    color: #735533;
    border-color: #e2d6c4;
    background: #fffaf2;
}

.wf-tool__state--action {
    justify-content: flex-start;
    text-align: left;
}

.wf-tool__state--error {
    color: #8d352e;
    border-color: #e7c8c4;
    background: #fff6f4;
}

.wf-tool__button {
    display: inline-flex;
    min-height: 40px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin-left: auto;
    padding: 0.35rem 0.75rem;
    border: 1px solid #aebfb9;
    border-radius: 6px;
    color: #435851;
    background: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.wf-tool__button:hover,
.wf-tool__button:focus-visible {
    border-color: #6e8c82;
    background: #f2f7f5;
    outline: none;
}

.wf-tool__button--primary {
    color: #fff;
    border-color: #28775f;
    background: #28775f;
}

.wf-tool__button--primary:hover,
.wf-tool__button--primary:focus-visible {
    color: #fff;
    border-color: #1f604d;
    background: #1f604d;
}

.wf-tool__button .material-icons {
    font-size: 1rem;
}

.wf-tool__state--error .wf-tool__button {
    margin-left: 0;
    color: #8d352e;
    border-color: #c9867f;
}

.wf-tool__spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 2px solid #c6d8d2;
    border-top-color: #28775f;
    border-radius: 50%;
    animation: wf-spin 700ms linear infinite;
}

@keyframes wf-spin {
    to { transform: rotate(360deg); }
}

.wf-results__summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
    color: #64756f;
    font-size: 0.76rem;
}

.wf-results__summary strong {
    color: #263a33;
    font-size: 0.85rem;
}

.wf-results__table-wrap {
    overflow-x: auto;
    border: 1px solid #d7e1de;
    border-radius: 6px;
}

.wf-results table {
    width: 100%;
    min-width: 440px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.wf-results th,
.wf-results td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid #e4ebe8;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.wf-results thead th {
    color: #66766f;
    background: #f6f8f7;
    font-size: 0.72rem;
}

.wf-results th:first-child {
    width: 60%;
    text-align: left;
}

.wf-results tbody th {
    overflow-wrap: anywhere;
    color: #253a32;
    font-weight: 600;
}

.wf-results tbody tr:last-child th,
.wf-results tbody tr:last-child td {
    border-bottom: 0;
}

.wf-results__note {
    margin: 0.6rem 0 0;
    color: #74817d;
    font-size: 0.71rem;
    line-height: 1.55;
}

@media (max-width: 640px) {
    .wf-tool__disclosure > summary {
        grid-template-columns: auto 1fr auto;
        padding-inline: 0.9rem;
    }

    .wf-tool__summary-detail {
        display: none;
    }

    .wf-tool__body {
        padding: 0.9rem;
    }

    .wf-tool__controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .wf-segmented {
        display: grid;
        grid-template-columns: auto 1fr 1fr;
    }

    .wf-segmented legend {
        min-width: 58px;
    }

    .wf-segmented span {
        justify-content: center;
    }

    .wf-results__summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }

    .wf-tool__state--action {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .wf-tool__state--action .wf-tool__button {
        width: 100%;
        margin-left: 0;
    }

    .wf-results table {
        min-width: 0;
        table-layout: fixed;
        font-size: 0.76rem;
    }

    .wf-results th,
    .wf-results td {
        padding: 0.58rem 0.4rem;
    }

    .wf-results th:first-child {
        width: 50%;
    }

    .wf-results th:nth-child(2),
    .wf-results th:nth-child(3) {
        width: 25%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wf-tool__chevron,
    .wf-tool__spinner {
        animation: none;
        transition: none;
    }
}
