.ew-active-filters {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
  padding: 7px 10px 7px 14px;
  background: var(--ui-surface, #fff);
  color: var(--ui-ink, #162237);
  border: 1px solid var(--ui-line, #d8e0ec);
  border-radius: 11px;
  box-shadow: 0 4px 14px rgb(22 34 55 / 10%);
}
.ew-active-filters [hidden] { display: none !important; }
.ew-af-label,
.ew-af-state { color: var(--ui-muted, #53627a); font-weight: 650; }
.ew-af-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 9px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.ew-af-account {
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--ui-accent-soft, #eeeafd);
  color: var(--ui-accent, #54419a);
}
.ew-af-period { white-space: nowrap; }
.ew-af-short { display: none; }
.ew-af-extra {
  border-left: 1px solid var(--ui-line, #d8e0ec);
  padding-left: 9px;
  color: var(--ui-muted, #53627a);
}
.ew-active-filters .ew-af-edit {
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid #b6a9e2;
  background: var(--ui-accent-soft, #eeeafd);
  color: var(--ui-accent, #54419a);
  font-weight: 700;
  white-space: nowrap;
}
.ew-active-filters .ew-af-edit:hover { background: #e4dcfa; }

@media (max-width: 660px) {
  .ew-active-filters {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 4px 6px 4px 8px;
  }
  .ew-af-full,
  .ew-af-label { display: none; }
  .ew-af-short { display: inline; }
  .ew-af-summary { gap: 1px 6px; }
  .ew-af-extra,
  .ew-af-state { border: 0; padding: 0; font-size: 11px; }
  .ew-active-filters .ew-af-edit { min-height: 44px; padding-inline: 7px; }
}

/* Keep results accessible on landscape phones and in printouts. */
@media (max-height: 360px) { .ew-active-filters { position: static; } }
@media print { .ew-active-filters { display: none !important; } }
