.archive-filter-control { justify-self: end; margin-inline-start: auto; }
.archive-filter-control .af-trigger {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 42px; padding: .45rem 1.05rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit;
}
.af-trigger .icon, .af-field label .icon { color: var(--accent); width: 17px; height: 17px; }
.af-trigger b { font-size: .78em; color: var(--accent); }
.archive-filter-control .af-trigger:hover, .af-input-wrap:focus-within { border-color: var(--accent); }
dialog.af-panel {
  box-sizing: border-box; position: fixed; inset: var(--af-top, 12vh) var(--af-right, 3vw) auto auto;
  width: min(506px, calc(100vw - 24px)); max-height: calc(100dvh - var(--af-top, 12vh) - 12px);
  margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 19px;
  color: var(--text); background: var(--surface); box-shadow: 0 14px 48px #10142026;
  font-family: inherit; text-align: start; overflow: auto; overscroll-behavior: contain;
}
.af-panel::backdrop { background: rgb(25 22 32 / 8%); backdrop-filter: none; }
.af-panel form { display: block; margin: 0; padding: 0; }
.af-panel button, .af-panel input { font: inherit; color: inherit; }
.af-heading, .af-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.af-heading { padding: 19px 23px 14px; }
.af-panel .af-heading h2 { margin: 0; font-size: 1.16rem; font-weight: 550; line-height: 1.5; }
.af-panel .af-close, .af-panel .af-remove { display: grid; place-items: center; min-width: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 21px; line-height: 1; }
.af-panel button:hover { color: var(--accent); }
.af-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px 16px; align-items: start; padding: 0 23px 21px; }
.af-field { min-width: 0; }
.af-field label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: .82rem; color: var(--muted); }
.af-input-wrap { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--background); }
.af-panel .af-input { box-sizing: border-box; width: 100%; min-width: 0; height: 41px; margin: 0; padding: 0 10px; background: transparent; border: 0; box-shadow: none; outline: none; font-size: .88rem; }
.af-input::placeholder { color: var(--muted); opacity: .85; }
.af-panel [hidden] { display: none; }
.af-field ul { list-style: none; margin: 4px 0 0; padding: 3px; border: 1px solid var(--border); border-radius: 9px; max-height: 165px; overflow-y: auto; }
.af-field li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border-radius: 6px; cursor: pointer; font-size: .83rem; line-height: 1.4; overflow-wrap: anywhere; }
.af-field li:hover, .af-field li[aria-selected=true] { background: var(--soft); color: var(--accent); }
.af-field small, .af-status { color: var(--muted); font-size: .76rem; }
.af-status:not(:empty) { display: block; padding: 5px 2px; }
.af-actions { position: sticky; bottom: 0; padding: 12px 23px; background: var(--surface); border-top: 1px solid var(--border); }
.af-actions button { border-radius: 9px; border: 0; min-height: 40px; padding: 0 12px; }
.af-actions .af-clear { background: transparent; color: var(--muted); }
.af-panel .af-apply { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--on-accent, var(--surface)); }
.af-panel .af-apply:hover { color: var(--on-accent, var(--surface)); opacity: .88; }
.af-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.af-chips span { padding: 3px 9px; color: var(--text); background: var(--soft); border-radius: 6px; font-size: .76rem; }
.af-chips a { color: var(--accent); font-size: .78rem; }
@media (max-width: 760px) {
  .archive-home .browse-header { flex-direction: row; align-items: center; }
  .archive-home .browse-filters { display: flex; justify-content: space-between; }
}
@media (max-width: 560px) {
  dialog.af-panel { inset: auto 0 0; width: 100%; max-width: 100%; max-height: 86dvh; border-radius: 18px 18px 0 0; }
  .af-heading, .af-actions { padding-inline: 16px; }
  .af-fields { padding-inline: 16px; gap: 12px 10px; }
  .af-panel .af-input { font-size: 16px; }
  .af-actions { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
