.savedviews-strip {
    padding: 0.5rem 0.75rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: 0.75rem;
}
.savedviews-strip__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
}
.savedview-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    text-decoration: none;
    transition: all .15s ease;
}
.savedview-chip:hover {
    border-color: var(--brand-primary, #0d6efd);
    color: var(--brand-primary, #0d6efd);
}
.savedview-chip.is-active {
    background: var(--brand-primary, #0d6efd);
    color: #fff;
    border-color: transparent;
}
.savedview-chip--preset {
    background: var(--bs-tertiary-bg);
}
.savedview-chip--default {
    font-weight: 600;
}
.savedview-chip--pinned {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.06), transparent);
}
.savedview-chip--pinned i.bi-pin-angle-fill {
    color: #f59e0b;
}
.savedview-chip--save {
    background: transparent;
    color: var(--brand-primary, #0d6efd);
    border-style: dashed;
    cursor: pointer;
}
.savedview-chip--save:hover {
    background: rgba(13, 110, 253, 0.06);
}

.preset-strip {
    padding: 0.4rem 0.6rem;
}
.preset-strip__label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
}
.preset-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .12s ease;
}
.preset-chip--primary {
    color: var(--brand-primary, #0d6efd);
    background: rgba(13, 110, 253, 0.08);
}
.preset-chip--primary:hover {
    background: rgba(13, 110, 253, 0.16);
}
.preset-chip--success {
    color: #198754;
    background: rgba(25, 135, 84, 0.08);
}
.preset-chip--success:hover {
    background: rgba(25, 135, 84, 0.16);
}
.preset-chip--warning {
    color: #fd7e14;
    background: rgba(253, 126, 20, 0.10);
}
.preset-chip--warning:hover {
    background: rgba(253, 126, 20, 0.18);
}
.preset-chip--danger {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}
.preset-chip--danger:hover {
    background: rgba(220, 53, 69, 0.16);
}
.preset-chip--info {
    color: #0dcaf0;
    background: rgba(13, 202, 240, 0.08);
}
.preset-chip--info:hover {
    background: rgba(13, 202, 240, 0.16);
}
.preset-chip--secondary {
    color: var(--bs-secondary-color);
    background: var(--bs-secondary-bg);
}
.preset-chip--secondary:hover {
    background: var(--bs-tertiary-bg);
}

.advfilter-builder {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-body-bg);
    overflow: hidden;
}
.advfilter-builder[open] {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.advfilter-builder__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    list-style: none;
    user-select: none;
    background: var(--bs-tertiary-bg);
}
.advfilter-builder__toggle::-webkit-details-marker {
    display: none;
}
.advfilter-builder__toggle:hover {
    background: var(--bs-secondary-bg);
}
.advfilter-builder__count {
    background: var(--brand-primary, #0d6efd);
    color: #fff;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 1.4rem;
    text-align: center;
}
.advfilter-builder__chevron {
    margin-left: auto;
    transition: transform .2s ease;
}
.advfilter-builder[open] .advfilter-builder__chevron {
    transform: rotate(180deg);
}
.advfilter-builder__form {
    padding: 0;
}
.advfilter-builder__body {
    padding: 0.9rem 1rem;
}
.advfilter-builder__head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.7rem;
}
.advfilter-builder__title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.advfilter-builder__logic {
    display: inline-flex;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-left: auto;
}
.advfilter-builder__logic input {
    display: none;
}
.advfilter-builder__logic label {
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    cursor: pointer;
    transition: all .12s ease;
    margin: 0;
}
.advfilter-builder__logic label:hover {
    background: var(--bs-tertiary-bg);
}
.advfilter-builder__logic input:checked + label {
    background: var(--brand-primary, #0d6efd);
    color: #fff;
}

.advfilter-builder__clauses {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.advfilter-clause {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
}
.advfilter-clause__field,
.advfilter-clause__op,
.advfilter-clause__value {
    font-size: 0.8125rem;
}
.advfilter-clause__remove {
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--bs-secondary-color);
    border-radius: 0.4rem;
}
.advfilter-clause__remove:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.06);
}

.advfilter-builder__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}
.advfilter-builder__add {
    font-size: 0.8125rem;
}

@media (max-width: 640px) {
    .advfilter-clause {
        grid-template-columns: 1fr;
    }
}

.ehr-active-filter--view {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.06), transparent);
    border-color: rgba(13, 110, 253, 0.20);
    cursor: default;
    pointer-events: none;
}
.ehr-active-filter--view i.bi-bookmark-star-fill {
    color: #f59e0b;
}
.ehr-active-filter--adv {
    background: rgba(108, 117, 125, 0.06);
    border-color: rgba(108, 117, 125, 0.18);
    font-family: var(--bs-font-monospace, ui-monospace, SFMono-Regular, monospace);
    font-size: 0.78rem;
}
.ehr-active-filter--adv i.bi-braces {
    color: var(--bs-secondary-color);
}

.filter-shell > * + * {
    margin-top: 0.5rem;
}
.cdir-filter-grid--two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) {
    .cdir-filter-grid--two {
        grid-template-columns: 1fr;
    }
}

[data-theme="dark"] .savedviews-strip {
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .savedview-chip {
    border-color: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .savedview-chip:hover {
    border-color: var(--brand-solid, var(--brand-primary, #0d6efd));
    color: var(--brand-solid, var(--brand-primary, #0d6efd));
}
[data-theme="dark"] .savedview-chip--pinned {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.12), transparent);
}
[data-theme="dark"] .savedview-chip--save:hover {
    background: rgba(13, 110, 253, 0.12);
}
[data-theme="dark"] .preset-chip--primary {
    background: rgba(13, 110, 253, 0.16);
}
[data-theme="dark"] .preset-chip--primary:hover {
    background: rgba(13, 110, 253, 0.26);
}
[data-theme="dark"] .preset-chip--success {
    background: rgba(25, 135, 84, 0.18);
}
[data-theme="dark"] .preset-chip--warning {
    background: rgba(253, 126, 20, 0.20);
}
[data-theme="dark"] .preset-chip--danger {
    background: rgba(220, 53, 69, 0.18);
}
[data-theme="dark"] .preset-chip--info {
    background: rgba(13, 202, 240, 0.18);
}
[data-theme="dark"] .advfilter-builder {
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .advfilter-builder[open] {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.30);
}
[data-theme="dark"] .advfilter-clause__remove:hover {
    background: rgba(220, 53, 69, 0.14);
}
[data-theme="dark"] .ehr-active-filter--view {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.14), transparent);
    border-color: rgba(13, 110, 253, 0.32);
}
[data-theme="dark"] .ehr-active-filter--adv {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.10);
}
