.dwtf {
    --dwtf-blue: #0075a3;
    --dwtf-blue-dark: #005f86;
    --dwtf-orange: #f5a20b;
    --dwtf-text: #24313a;
    --dwtf-muted: #78858d;
    --dwtf-border: #d9e2e7;
    --dwtf-soft: #f5f8fa;
    --dwtf-shadow: 0 14px 38px rgba(26, 55, 72, .13);

    position: relative;
    width: 100%;
    margin: 0 0 22px;
    color: var(--dwtf-text);
    font: inherit;
    z-index: 20;
}

.dwtf__bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.dwtf__facet {
    position: relative;
    min-width: 0;
}

.dwtf__trigger {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 0 17px;
    border: 1px solid var(--dwtf-border);
    border-radius: 0;
    background: #fff;
    color: var(--dwtf-text);
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease, color .16s ease;
}

.dwtf__trigger:hover,
.dwtf__trigger:focus-visible,
.dwtf__facet--open .dwtf__trigger {
    border-color: var(--dwtf-blue);
    box-shadow: 0 0 0 2px rgba(0, 117, 163, .08);
    outline: 0;
}

.dwtf__trigger--active {
    color: var(--dwtf-blue-dark);
    border-color: rgba(0, 117, 163, .55);
}

.dwtf__trigger-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dwtf__selected-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin-left: 9px;
    padding: 0 6px;
    border-radius: 0;
    background: var(--dwtf-orange);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.dwtf__selected-count[hidden] {
    display: none;
}

.dwtf__chevron {
    width: 10px;
    height: 10px;
    margin-left: auto;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transform-origin: center;
    transition: transform .16s ease;
    flex: 0 0 auto;
}

.dwtf__facet--open .dwtf__chevron {
    transform: rotate(225deg) translate(-1px, -1px);
}

.dwtf__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 100;
    width: max(100%, 340px);
    max-width: min(430px, calc(100vw - 32px));
    max-height: 390px;
    padding: 10px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--dwtf-border);
    border-radius: 0;
    background: #fff;
    box-shadow: var(--dwtf-shadow);
}

.dwtf__facet:last-child .dwtf__panel {
    right: 0;
    left: auto;
}

.dwtf__panel[hidden] {
    display: none;
}

.dwtf__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.dwtf__option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    margin: 0;
    padding: 7px 9px;
    border-radius: 0;
    color: var(--dwtf-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.25;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}

.dwtf__option:hover {
    background: var(--dwtf-soft);
}

.dwtf__option--selected {
    background: rgba(0, 117, 163, .08);
    color: var(--dwtf-blue-dark);
}

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

.dwtf__box {
    position: relative;
    width: 18px;
    height: 18px;
    border: 1.5px solid #b8c6ce;
    border-radius: 0;
    background: #fff;
    transition: border-color .12s ease, background-color .12s ease;
}

.dwtf__option input:focus-visible + .dwtf__box {
    outline: 2px solid rgba(0, 117, 163, .22);
    outline-offset: 2px;
}

.dwtf__option input:checked + .dwtf__box {
    border-color: var(--dwtf-blue);
    background: var(--dwtf-blue);
}

.dwtf__option input:checked + .dwtf__box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}

.dwtf__option-name {
    min-width: 0;
}

.dwtf__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    border-radius: 0;
    background: #edf1f3;
    color: #66757e;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.dwtf__option--selected .dwtf__count {
    background: rgba(0, 117, 163, .13);
    color: var(--dwtf-blue-dark);
}

.dwtf__option--unavailable {
    color: #a8b1b6;
    cursor: default;
    opacity: .7;
}

.dwtf__option--unavailable:hover {
    background: transparent;
}

.dwtf__option--unavailable .dwtf__box {
    background: #f3f5f6;
    border-color: #d7dde0;
}

.dwtf__option--unavailable .dwtf__count {
    background: #f1f3f4;
    color: #a8b1b6;
}

.dwtf__footer {
    display: flex;
    align-items: center;
    min-height: 28px;
    margin-top: 9px;
}

.dwtf__reset {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: var(--dwtf-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color .12s ease;
}

.dwtf__reset:hover,
.dwtf__reset:focus-visible {
    color: var(--dwtf-blue-dark);
    outline: 0;
}

.dwtf__reset[hidden] {
    display: none;
}

.dwtf__reset-icon {
    position: relative;
    width: 13px;
    height: 13px;
}

.dwtf__reset-icon::before,
.dwtf__reset-icon::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 0;
    width: 13px;
    height: 1px;
    background: currentColor;
}

.dwtf__reset-icon::before {
    transform: rotate(45deg);
}

.dwtf__reset-icon::after {
    transform: rotate(-45deg);
}

.dwtf__noscript-submit {
    padding: 8px 14px;
    border: 0;
    border-radius: 0;
    background: var(--dwtf-blue);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

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

.dwtf--loading .dwtf__trigger,
.dwtf--loading .dwtf__reset {
    pointer-events: none;
}

.dwtf-target--loading {
    opacity: .5;
    pointer-events: none;
}

.dwtf-target {
    transition: opacity .16s ease;
}

@media (max-width: 980px) {
    .dwtf__bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dwtf__facet:nth-child(even) .dwtf__panel {
        right: 0;
        left: auto;
    }
}

@media (max-width: 600px) {
    .dwtf {
        margin-bottom: 16px;
    }

    .dwtf__bar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .dwtf__trigger {
        min-height: 48px;
        font-size: 15px;
    }

    .dwtf__panel,
    .dwtf__facet:nth-child(even) .dwtf__panel,
    .dwtf__facet:last-child .dwtf__panel {
        right: auto;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: min(360px, 60vh);
    }

    .dwtf__options {
        grid-template-columns: 1fr;
    }
}
