.filter-dialog {
    width: 720px;
    max-width: 96vw;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0;
    background: #8885bc;
    color: black;
    font-family: inherit;
}

/* Two-column layout */
.fd-layout {
    display: flex;
    height: 420px;
}

/* ── Left ─────────────────────────────────────── */
.fd-left {
    display: flex;
    flex-direction: column;
    width: 50%;
    border-right: 1px solid #333;
    padding: 0 0 8px 0;
}

.fd-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.fd-tab {
    flex: 1;
    padding: 8px 4px;
    background: none;
    border: none;
    border-right: 1px solid #333;
    cursor: pointer;
}
.fd-tab:last-child { border-right: none; }
.fd-tab.active {
    color: #e0e0e0;
    background: #252525;
    border-bottom: 2px solid #4a9eff;
}
.fd-tab:hover:not(.active) { background: #222; }

/* Panels */
.fd-panel {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 14px 14px 8px;
    flex: 1;
}
.fd-panel.active { display: flex; }

.fd-panel label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: #aaa;
}

.fd-input {
    padding: 5px 8px;
    background: #111;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.9rem;
}
.fd-input:focus { outline: none; border-color: #4a9eff; }

.fd-input-num { width: 80px; }

.fd-select {
    padding: 5px 6px;
    background: #111;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.fd-length-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Toggles */
.fd-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.fd-toggle {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: #555;
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}
.fd-toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ccc;
    transition: left 0.2s, background 0.2s;
}
.fd-toggle.on {
    background: #4a9eff;
}
.fd-toggle.on::after {
    left: 21px;
    background: #fff;
}

/* + buttons inside panels */
.fd-panel .fd-add {
    align-self: flex-end;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #252525;
    color: #e0e0e0;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}
.fd-panel .fd-add:hover { background: #333; }

/* Tag row at the bottom of left column */
.fd-tag-row {
    display: flex;
    gap: 6px;
    padding: 8px 14px 0;
    border-top: 1px solid #2a2a2a;
    margin-top: auto;
}
.fd-tag-input { flex: 1; font-size: 1.2rem; }

.fd-tag-row .fd-add {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #252525;
    color: #e0e0e0;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
}
.fd-tag-row .fd-add:hover { background: #333; }

/* ── Right ────────────────────────────────────── */
.fd-right {
    display: flex;
    flex-direction: column;
    width: 50%;
}

.fd-rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #333;
}

.fd-scope-label {
    font-size: 0.75rem;
    color: #4a9eff;
    background: #1a2a3a;
    padding: 2px 7px;
    border-radius: 10px;
}

.fd-rules-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fd-rule-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252525;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.fd-rule-remove {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 0 0 8px;
}
.fd-rule-remove:hover { color: #e05555; }

/* ── Footer ───────────────────────────────────── */
.fd-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #333;
}

.fd-btn-primary, .fd-btn-secondary {
    padding: 6px 18px;
    border-radius: 4px;
    border: 1px solid #555;
    cursor: pointer;
    font-size: 0.9rem;
}
.fd-btn-primary {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #fff;
}
.fd-btn-primary:hover { background: #3a8eef; }
.fd-btn-secondary {
    background: #252525;
    color: #ccc;
}
.fd-btn-secondary:hover { background: #333; }