.task-taxonomy-panel {
    position: relative;
    z-index: 5;
    margin-bottom: 10px;
    padding: 29px 10px 10px;
    border: 1px solid color-mix(in srgb, var(--library-violet) 31%, var(--library-border));
    border-radius: 14px;
    background:
        linear-gradient(100deg, rgba(255, 251, 243, .9), rgba(255, 255, 255, .78) 57%, rgba(246, 249, 255, .86)),
        var(--library-surface);
    box-shadow: 0 8px 24px rgba(57, 82, 125, .045);
}

.task-taxonomy-panel__label {
    position: absolute;
    top: 9px;
    left: 47px;
    color: #7489ab;
    font-size: var(--font-size-100);
    font-weight: 500;
    letter-spacing: .01em;
}

.task-taxonomy-panel__track {
    display: grid;
    min-width: 0;
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 4px;
}

.task-taxonomy-panel .task-direction-pills {
    min-width: 0;
    overflow-x: auto;
    padding: 1px 2px 3px;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
}

.task-taxonomy-panel .task-direction-pill {
    min-width: max-content;
    min-height: 40px;
    flex: 1 0 auto;
    padding: 0 20px;
    border-color: color-mix(in srgb, #d8ccb7 50%, var(--library-border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--library-surface-solid) 82%, #fffaf0);
    color: #415b80;
    scroll-snap-align: start;
}

.task-taxonomy-panel .task-direction-pill > i {
    width: 19px;
    color: #7797c9;
    font-size: var(--font-size-300);
    text-align: center;
}

.task-taxonomy-panel .task-direction-pill.is-active {
    border-color: var(--site-accent-border);
    background: var(--site-accent-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--site-accent) 10%, transparent);
    color: var(--site-accent);
}

.task-taxonomy-panel .task-direction-pill.is-active > i {
    color: var(--site-accent);
}

.task-direction-scroll {
    display: inline-grid;
    width: 28px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #7190c0;
    font: inherit;
    cursor: pointer;
    place-items: center;
    transition: background 150ms ease, color 150ms ease;
}

.task-direction-scroll:hover {
    background: var(--site-accent-soft);
    color: var(--site-accent-hover);
}

.task-context-filters {
    position: relative;
    z-index: 10;
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(280px, 1.35fr) minmax(160px, .86fr) minmax(150px, .84fr) 120px 120px 138px;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
    padding: 8px 0;
    border-top: 1px solid color-mix(in srgb, var(--library-border) 74%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--library-border) 74%, transparent);
}

.task-context-filters:has(.task-custom-select.is-open) {
    z-index: 1250;
}

.task-context-filters__heading {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 0 12px;
}

.task-context-filters__heading strong {
    overflow: hidden;
    color: var(--library-text);
    font-size: var(--font-size-100);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-context-filters__heading span {
    overflow: hidden;
    color: var(--library-muted);
    font-size: var(--font-size-100);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-custom-select {
    position: relative;
    min-width: 0;
}

.task-custom-select__trigger {
    display: grid;
    width: 100%;
    min-height: 42px;
    grid-template-columns: 18px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--library-border);
    border-radius: 10px;
    background: var(--library-surface);
    box-shadow: 0 6px 18px rgba(55, 82, 126, .035);
    color: #627695;
    font: inherit;
    font-size: var(--font-size-100);
    text-align: left;
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.task-custom-select__trigger > i:first-child {
    color: #7991b4;
    font-size: var(--font-size-100);
}

.task-custom-select__trigger > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-custom-select__trigger:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.task-custom-select__chevron {
    color: #8398b6;
    font-size: var(--font-size-100);
    transition: transform 150ms ease;
}

.task-custom-select.is-open .task-custom-select__trigger {
    border-color: var(--site-accent-border);
    background: var(--library-surface-solid);
    box-shadow: 0 0 0 3px var(--site-accent-focus);
}

.task-custom-select.is-open .task-custom-select__chevron {
    transform: rotate(180deg);
}

.task-custom-select__menu {
    position: absolute;
    z-index: 1260;
    top: calc(100% + 7px);
    left: 0;
    display: grid;
    width: min(380px, 88vw);
    max-height: 350px;
    gap: 3px;
    padding: 8px;
    overflow-y: auto;
    border: 1px solid #9ab9eb;
    border-radius: 11px;
    background: color-mix(in srgb, var(--library-surface-solid) 96%, #fffaf0);
    box-shadow: 0 18px 42px rgba(44, 70, 112, .18);
}

.task-custom-select__menu[hidden] {
    display: none !important;
}

.task-custom-select__menu--sections {
    width: min(520px, 88vw);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-custom-select__option {
    display: grid;
    min-width: 0;
    min-height: 39px;
    grid-template-columns: 22px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #49617f;
    font: inherit;
    font-size: var(--font-size-100);
    text-align: left;
    cursor: pointer;
}

.task-custom-select__option:hover,
.task-custom-select__option:focus-visible {
    outline: 0;
    background: var(--site-accent-soft);
    color: var(--site-accent-hover);
}

.task-custom-select__option[hidden] {
    display: none !important;
}

.task-custom-select__option > i:first-child {
    color: #7394ca;
    font-size: var(--font-size-200);
    text-align: center;
}

.task-custom-select__option > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-custom-select__option[aria-selected="true"] {
    background: var(--site-accent-soft);
    color: var(--site-accent);
    font-weight: 500;
}

.task-custom-select__check {
    visibility: hidden;
    color: var(--site-accent);
    font-size: var(--font-size-100);
}

.task-custom-select__option[aria-selected="true"] .task-custom-select__check {
    visibility: visible;
}

.task-custom-select__empty {
    padding: 13px 11px;
    color: var(--library-muted);
    font-size: var(--font-size-100);
    line-height: 1.4;
}

.task-context-filters .task-filter-control {
    width: 100%;
    min-width: 0;
    flex: none;
}

.task-filter-search-row {
    display: grid;
    grid-template-columns: minmax(300px, 410px) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.task-filter-search-row .task-filter-search {
    width: 100%;
    min-width: 0;
    min-height: 42px;
}

.task-filter-search-row .task-filter-row--active {
    min-width: 0;
    min-height: 42px;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
}

.task-filter-search-row .task-active-filters {
    overflow: hidden;
    flex-wrap: nowrap;
}

.task-filter-search-row .task-filter-chip {
    min-height: 30px;
    flex: 0 1 auto;
    border: 1px solid var(--site-accent-border);
    border-radius: 9px;
    background: var(--site-accent-soft);
    color: var(--site-accent);
    font-size: var(--font-size-100);
}

.task-filter-search-row .task-filter-reset {
    min-height: 34px;
    color: #7185a4;
    font-size: var(--font-size-100);
    white-space: nowrap;
}

.task-filter-search-row + .task-list {
    margin-top: 12px;
}

.task-direction-scroll:focus-visible,
.task-custom-select__trigger:focus-visible,
.task-taxonomy-panel .task-direction-pill:focus-visible {
    outline: 3px solid var(--site-accent-focus);
    outline-offset: 2px;
}

[data-theme="dark"] .task-taxonomy-panel {
    background: linear-gradient(100deg, rgba(44, 40, 61, .92), rgba(24, 35, 55, .9));
}

[data-theme="dark"] .task-taxonomy-panel .task-direction-pill,
[data-theme="dark"] .task-custom-select__trigger,
[data-theme="dark"] .task-custom-select__menu {
    border-color: var(--library-border);
    background: var(--library-surface-solid);
    color: var(--library-text);
}

[data-theme="dark"] .task-taxonomy-panel__label {
    color: #b4c5df;
}

[data-theme="dark"] .task-taxonomy-panel .task-direction-pill.is-active {
    border-color: var(--site-accent-border);
    background: var(--site-accent-soft);
    color: var(--site-accent);
}

[data-theme="dark"] .task-taxonomy-panel .task-direction-pill.is-active > i {
    color: var(--site-accent);
}

[data-theme="dark"] .tasks-page--library .task-filter-control select,
[data-theme="dark"] .tasks-page--library .task-filter-control.has-value select {
    color: #d2def0;
    color-scheme: dark;
}

[data-theme="dark"] .task-filter-search-row .task-filter-chip {
    border-color: var(--site-accent-border);
    background: var(--site-accent-soft);
    color: var(--site-accent);
}

[data-theme="dark"] .task-custom-select__option {
    color: var(--library-text);
}

[data-theme="dark"] .task-custom-select__option:hover,
[data-theme="dark"] .task-custom-select__option:focus-visible,
[data-theme="dark"] .task-custom-select__option[aria-selected="true"] {
    background: var(--library-blue-soft);
}

@media (max-width: 1260px) {
    .task-context-filters {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .task-context-filters__heading {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: baseline;
        gap: 14px;
        padding-inline: 2px;
    }
}

@media (max-width: 980px) {
    .task-taxonomy-panel .task-direction-pill {
        flex-grow: 0;
    }

    .task-context-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .task-filter-search-row {
        grid-template-columns: minmax(260px, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .task-taxonomy-panel {
        padding-right: 5px;
        padding-left: 5px;
    }

    .task-taxonomy-panel__label {
        left: 39px;
    }

    .task-taxonomy-panel__track {
        grid-template-columns: 26px minmax(0, 1fr) 26px;
        gap: 1px;
    }

    .task-taxonomy-panel .task-direction-pill {
        min-height: 42px;
        padding-inline: 15px;
    }

    .task-context-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .task-context-filters__heading,
    .task-custom-select--section,
    .task-custom-select--topic {
        grid-column: 1 / -1;
    }

    .task-context-filters__heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .task-custom-select__menu,
    .task-custom-select__menu--sections {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .task-filter-search-row {
        grid-template-columns: 1fr;
    }

    .task-filter-search-row .task-filter-row--active {
        align-items: flex-start;
    }

    .task-filter-search-row .task-active-filters {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .task-context-filters {
        grid-template-columns: 1fr;
    }

    .task-context-filters > * {
        grid-column: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .task-taxonomy-panel .task-direction-pills {
        scroll-behavior: auto;
    }

    .task-direction-scroll,
    .task-custom-select__trigger,
    .task-custom-select__chevron {
        transition: none;
    }
}
