/* Shared choice filters keep multiple selections in a compact top-layer menu. */
.choice-filter-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 31px;
    padding: 5px 48px 5px 8px;
    overflow: hidden;
    border: 1px solid rgba(18, 57, 93, .15);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 11.5px;
    font-weight: 500;
    text-align: left;
    box-shadow: none;
    transform: none;
    cursor: pointer;
}

/* Choice filters own their arrow so compact table controls can tune it independently. */
.choice-filter-trigger::before {
    position: absolute;
    top: 22%;
    right: 39px;
    bottom: 22%;
    width: 1px;
    background: var(--border);
    content: "";
}

.choice-filter-trigger::after {
    position: absolute;
    top: 50%;
    right: 13px;
    width: 12px;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%23586f82' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    content: "";
    transform: translateY(-50%);
}

/* Narrow table filters reserve less space and place the divider nearer the arrow. */
.column-filters .choice-filter-trigger {
    padding-right: 40px;
}

.column-filters .choice-filter-trigger::before {
    right: 31px;
}

.column-filters .choice-filter-trigger::after {
    right: 9px;
    width: 9px;
    height: 6px;
}

.choice-filter-trigger > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.choice-filter-trigger.is-active {
    border-color: var(--blue-600);
    background: var(--blue-050);
    color: var(--blue-700);
}

.choice-filter-trigger:hover {
    border-color: var(--blue-500);
    background: #fff;
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.choice-filter-trigger.is-active:hover {
    background: var(--blue-050);
    color: var(--blue-700);
}

.choice-filter-trigger:focus-visible {
    border-color: var(--blue-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(49, 146, 208, .14);
}

.choice-filter-popover {
    position: fixed;
    inset: unset;
    box-sizing: border-box;
    width: max-content;
    min-width: 200px;
    max-width: min(340px, calc(100vw - 24px));
    margin: 0;
    padding: 10px 12px 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 12px 30px rgba(7, 23, 39, .2);
    text-align: left;
    text-transform: none;
}

/* The reset action needs its own outline now that the repeated heading is gone. */
.choice-filter-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: calc(100% - 20px);
    max-width: 240px;
    min-height: 27px;
    margin: 0 auto 6px;
    padding: 3px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.2;
    box-shadow: none;
    transition: border-color .15s ease, background .15s ease;
    cursor: pointer;
}

.choice-filter-popover > .choice-filter-clear:hover {
    border-color: var(--blue-500);
    background: var(--blue-050);
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.choice-filter-popover > .choice-filter-clear:focus-visible {
    outline: 2px solid var(--blue-600);
    outline-offset: 1px;
}

.choice-filter-options label:hover {
    background: var(--blue-050);
}

/* The unframed option list scrolls independently at the popover's outside edge. */
.choice-filter-options {
    max-height: min(280px, calc(100vh - 160px));
    margin-inline: -12px;
    padding: 4px 0 4px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: #8da1af transparent;
    scrollbar-width: thin;
}

.choice-filter-options::-webkit-scrollbar {
    width: 6px;
}

.choice-filter-options::-webkit-scrollbar-track {
    background: transparent;
}

.choice-filter-options::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #8da1af;
}

.choice-filter-popover .choice-filter-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 4px 8px;
    border-radius: 5px;
    color: var(--text);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: normal;
    line-height: 1.3;
    text-align: left;
    text-transform: none;
    cursor: pointer;
}

.choice-filter-options input[type="radio"] {
    flex: 0 0 16px;
    width: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--blue-700);
}

/* The apply action occupies a short footer below the choices. */
.choice-filter-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 24px;
    margin-inline: -12px;
    padding: 0 6px;
}

/* Keep the native submit button invisible while its separate arrow stays visible. */
.choice-filter-go-control {
    position: relative;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
}

.choice-filter-popover .choice-filter-go {
    all: unset;
    position: absolute;
    z-index: 1;
    inset: 0;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    opacity: 0;
    appearance: none;
    cursor: pointer;
}

.choice-filter-go-arrow {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #72899a;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    transform: translateY(-2px);
    transition: stroke .15s ease;
}

.choice-filter-go-control:hover .choice-filter-go-arrow,
.choice-filter-go:focus-visible + .choice-filter-go-arrow {
    stroke: var(--blue-600);
}

.choice-filter-go:focus-visible + .choice-filter-go-arrow {
    stroke-width: 2.5;
}

.column-filters th.status-column .choice-filter-trigger > span:first-child {
    flex: 1;
    text-align: center;
}
