/* Filter drawer: right-side on desktop, bottom-sheet on mobile */

.drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
}
.drawer[hidden] { display: none; }

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity .22s ease;
}
.drawer.open .drawer-backdrop { opacity: 1; }
html[data-theme="dark"] .drawer-backdrop { background: rgba(0, 0, 0, 0.6); }

.drawer-panel {
    position: relative;
    width: 420px;
    max-width: 94vw;
    height: 100%;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(0.2, 0.8, 0.25, 1);
    box-shadow: -4px 0 28px rgba(0, 0, 0, 0.12);
}
.drawer.open .drawer-panel { transform: translateX(0); }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.drawer-head h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.005em;
}
.drawer-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s ease;
    padding: 0;
}
.drawer-close:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-subtle); }
.drawer-close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.fgroup { display: flex; flex-direction: column; gap: 8px; }
.fgroup-label {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.fchips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all .12s ease;
}
.fchip:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.fchip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.fchip.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-fg);
}

.fdaterange {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.fdaterange[hidden] { display: none; }
.fdate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 140px;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.fdate:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--focus-ring);
    color: var(--text);
}
/* Required field highlighted when empty */
.fdate.is-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
    color: var(--text);
}
.fdate.is-error .fdate-label { color: #ef4444; }
.fdate-label {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-subtle);
    flex-shrink: 0;
}
.fdate-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    padding: 0;
    font-family: inherit;
}
.fdate-input::placeholder {
    color: var(--text-subtle);
    opacity: 0.8;
}

.finput {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.finput:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--focus-ring);
    color: var(--text);
}
.finput input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font: inherit;
    font-size: 13px;
    color: var(--text);
}

.drawer-foot {
    padding: 14px 18px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.drawer-foot .btn-secondary,
.drawer-foot .btn-primary {
    margin-top: 0;
    flex: 1;
    min-height: 40px;
    min-width: auto;
}
