/* Chip and badge.
   Chips: static, selectable (a button with aria-pressed and a check glyph),
   removable (its own labelled remove button), rejected (dashed, octagon, reason).
   Badges: neutral, metric type (Source, Calculated, Global; the word is always
   there), outline marks, the count badge, and its critical form (A13, A30):
   an exclamation mark, the count and a ring, so the difference is not colour. */

.pr-chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 2px 10px;
  border-radius: var(--pr-radius-pill);
  border: var(--pr-border-hairline) solid var(--pr-border-default);
  background: var(--pr-surface-nested);
  color: var(--pr-text-primary);
  font-size: 0.75rem; font-weight: 500; line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
}
/* A long label (a multi-site filter, a long rejected address) ends in an
   ellipsis instead of pushing past its card; the full text stays in the
   remove button's aria-label and in the title the macro sets. */
.pr-chip__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
button.pr-chip { cursor: pointer; }
button.pr-chip:hover, .pr-chip.is-hover { background: var(--pr-surface-hover); }
.pr-chip[aria-pressed="true"], .pr-chip.is-selected {
  background: var(--pr-brand-tint);
  border-color: var(--pr-brand-text);
  color: var(--pr-text-primary);
}
.pr-chip[aria-pressed="true"]:hover { background: var(--pr-brand-tint); }
.pr-chip.is-rejected { border-style: dashed; border-color: var(--pr-danger-text); color: var(--pr-danger-text); }
.pr-chip:focus-visible, .pr-chip.is-focus { outline: var(--pr-border-focus) solid var(--pr-focus-ring); outline-offset: var(--pr-border-focus); }
.pr-chip__x {
  position: relative; flex: none;
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; margin-right: -4px;
  border-radius: 50%;
  color: var(--pr-text-secondary);
  cursor: pointer;
}
.pr-chip__x:hover { background: var(--pr-surface-hover); color: var(--pr-text-primary); }
.pr-chip__x:focus-visible { outline: var(--pr-border-focus) solid var(--pr-focus-ring); outline-offset: 1px; }
.pr-chips { display: flex; flex-wrap: wrap; gap: var(--pr-space-sm); align-items: center; }

.pr-badge {
  display: inline-flex; align-items: center; gap: var(--pr-space-xs);
  padding: 3px var(--pr-space-sm);
  border-radius: var(--pr-radius-sm);
  font-size: 0.75rem; font-weight: 600; line-height: 1.2;
  white-space: nowrap;
  color: var(--pr-text-secondary);
  background: var(--pr-surface-nested);
}
.pr-badge--source { color: var(--pr-type-source); background: var(--pr-type-source-tint); }
.pr-badge--calc { color: var(--pr-type-calc); background: var(--pr-type-calc-tint); }
.pr-badge--global { color: var(--pr-type-global); background: var(--pr-type-global-tint); }
.pr-badge--outline { background: none; box-shadow: inset 0 0 0 1px var(--pr-border-control); }
.pr-badge--num { min-width: 24px; justify-content: center; }

/* Count badge: solid, for unresolved problems only; gone at zero. */
.pr-badge--count {
  min-width: 20px; justify-content: center;
  padding: 2px 6px;
  border-radius: var(--pr-radius-pill);
  background: var(--pr-danger-fill);
  color: var(--pr-text-on-brand);
  font-variant-numeric: tabular-nums;
}
.pr-badge--critical {
  gap: 2px;
  box-shadow: 0 0 0 2px var(--pr-surface-card), 0 0 0 4px var(--pr-danger-fill);
}
.pr-badge__bang { font-weight: 700; }

@media (max-width: 768px) {
  /* Phone sizes from the export (bundle.css .pr-phone rules). On a phone the
     table's filters are chips, so removing one must not need a 16px target:
     the remove button is drawn at 28px and its hit area reaches the touch
     target through ::before. */
  .pr-chip { min-height: 36px; }
  .pr-chip__x { width: 28px; height: 28px; margin-right: -8px; }
  .pr-chip__x::before {
    content: ""; position: absolute;
    left: 50%; top: 50%;
    width: var(--pr-touch-target); height: var(--pr-touch-target);
    transform: translate(-50%, -50%);
  }
}
