/*
 * @polyxd/react base styles. Every value comes from a semantic token (--pxd-*), so the loaded
 * design-system theme decides the look. Layout adapts to the surface's own width (container
 * queries), not the viewport, so a surface behaves the same in a phone frame or a sidebar.
 */

.pxd-surface {
  container: pxd / inline-size;
  position: relative;
  box-sizing: border-box;
  background: var(--pxd-color-surface-default);
  color: var(--pxd-color-text-default);
  font-family: var(--pxd-type-body-default-family);
  font-size: var(--pxd-type-body-default-size);
  font-weight: var(--pxd-type-body-default-weight);
  line-height: var(--pxd-type-body-default-line-height);
  letter-spacing: var(--pxd-type-body-default-letter-spacing);
  padding: var(--pxd-space-inset-comfortable);
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-loose);
  -webkit-font-smoothing: antialiased;
}
.pxd-surface *,
.pxd-surface *::before,
.pxd-surface *::after {
  box-sizing: border-box;
}
.pxd-surface :where(h1, h2, h3, h4, h5, h6, p, dl, dd, ul, ol, figure, fieldset) {
  margin: 0;
  padding: 0;
}
.pxd-surface :where(ul, ol) {
  list-style: none;
}
.pxd-surface :where(fieldset) {
  border: 0;
  min-width: 0;
}
.pxd-surface :where(button, input, textarea, select) {
  font: inherit;
  color: inherit;
}
.pxd-surface :focus-visible {
  outline: var(--pxd-focus-ring-width) solid var(--pxd-color-border-focus);
  outline-offset: var(--pxd-focus-ring-offset);
}
.pxd-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Typography roles */
.pxd-surface-title {
  font-family: var(--pxd-type-title-page-family);
  font-size: var(--pxd-type-title-page-size);
  font-weight: var(--pxd-type-title-page-weight);
  line-height: var(--pxd-type-title-page-line-height);
  letter-spacing: var(--pxd-type-title-page-letter-spacing);
}
.pxd-section-title,
.pxd-steps-title {
  font-family: var(--pxd-type-title-section-family);
  font-size: var(--pxd-type-title-section-size);
  font-weight: var(--pxd-type-title-section-weight);
  line-height: var(--pxd-type-title-section-line-height);
  letter-spacing: var(--pxd-type-title-section-letter-spacing);
}
.pxd-card-title,
.pxd-dialog-title,
.pxd-comparison-title,
.pxd-detail-title,
.pxd-chart-title,
.pxd-status-title {
  font-family: var(--pxd-type-title-item-family);
  font-size: var(--pxd-type-title-item-size);
  font-weight: var(--pxd-type-title-item-weight);
  line-height: var(--pxd-type-title-item-line-height);
  letter-spacing: var(--pxd-type-title-item-letter-spacing);
}
.pxd-text-body,
.pxd-dialog-description p,
.pxd-status-message,
.pxd-chart-summary,
.pxd-comparison-summary {
  max-width: calc(var(--pxd-measure-max) * 1ch);
}
.pxd-text-supporting,
.pxd-section-description,
.pxd-card-subtitle,
.pxd-field-help,
.pxd-metric-caption,
.pxd-option-description,
.pxd-steps-progress {
  font-family: var(--pxd-type-body-small-family);
  font-size: var(--pxd-type-body-small-size);
  line-height: var(--pxd-type-body-small-line-height);
  color: var(--pxd-color-text-muted);
}
.pxd-text-caption,
.pxd-collection-label,
.pxd-metric-label,
.pxd-table th[scope="col"],
.pxd-badge,
.pxd-range-bounds {
  font-family: var(--pxd-type-label-small-family);
  font-size: var(--pxd-type-label-small-size);
  font-weight: var(--pxd-type-label-small-weight);
  line-height: var(--pxd-type-label-small-line-height);
  letter-spacing: var(--pxd-type-label-small-letter-spacing);
  color: var(--pxd-color-text-muted);
}
.pxd-field-label,
.pxd-button,
.pxd-segment,
.pxd-views-tab,
.pxd-disclosure-trigger,
.pxd-toggle-label {
  font-family: var(--pxd-type-label-default-family);
  font-size: var(--pxd-type-label-default-size);
  font-weight: var(--pxd-type-label-default-weight);
  line-height: var(--pxd-type-label-default-line-height);
  letter-spacing: var(--pxd-type-label-default-letter-spacing);
}

/* Structure */
.pxd-stack {
  display: flex;
  flex-direction: column;
  gap: var(--polyxd-stack);
}
/* Separate questions need more air between them than the parts of one question. */
.pxd-form-fields,
.pxd-section > .pxd-stack,
.pxd-group.pxd-stack {
  gap: var(--polyxd-stack-apart);
}
.pxd-stack-tight {
  gap: var(--pxd-space-stack-tight);
}
.pxd-section {
  display: flex;
  flex-direction: column;
  gap: var(--polyxd-stack);
}
.pxd-section + .pxd-section,
.pxd-group > .pxd-section + .pxd-section {
  margin-top: calc(var(--pxd-space-stack-section) - var(--pxd-space-stack-loose));
}
.pxd-section-header {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-group {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-loose);
}
.pxd-group-inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--pxd-space-inline-loose);
}
.pxd-group-inline > * {
  flex: 1 1 12rem;
}
.pxd-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--pxd-space-inline-loose);
}
.pxd-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--pxd-color-surface-raised);
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  border-radius: var(--pxd-radius-default);
  box-shadow: var(--pxd-shadow-raised);
  overflow: hidden;
}
.pxd-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
  padding: var(--pxd-space-inset-default);
}
.pxd-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--pxd-space-inline-default);
}
.pxd-card-link {
  all: unset;
  cursor: pointer;
}
.pxd-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.pxd-card-actionable:hover {
  background: color-mix(in srgb, var(--pxd-color-text-default) calc(var(--pxd-opacity-state-hover) * 100%), var(--pxd-color-surface-raised));
}
.pxd-card-actionable:has(.pxd-card-link:focus-visible) {
  outline: var(--pxd-focus-ring-width) solid var(--pxd-color-border-focus);
  outline-offset: var(--pxd-focus-ring-offset);
}
.pxd-card-link:focus-visible {
  outline: none;
}
/* Controls inside an actionable card stay their own targets, above the card's stretched link. */
.pxd-card-actionable .pxd-card-children :is(button, input, select, textarea, a, [role="switch"], [role="checkbox"]) {
  position: relative;
  z-index: 1;
}
.pxd-card-media .pxd-media {
  width: 100%;
  border-radius: 0;
}
.pxd-badge {
  flex: none;
  padding: 2px var(--pxd-space-inline-default);
  border-radius: var(--pxd-radius-full);
  background: var(--pxd-color-surface-subtle);
  color: var(--pxd-color-text-default);
}
.pxd-tone-info { background: var(--pxd-color-status-info-background); color: var(--pxd-color-status-info-foreground); }
.pxd-tone-success { background: var(--pxd-color-status-success-background); color: var(--pxd-color-status-success-foreground); }
.pxd-tone-warning { background: var(--pxd-color-status-warning-background); color: var(--pxd-color-status-warning-foreground); }
.pxd-tone-danger { background: var(--pxd-color-status-danger-background); color: var(--pxd-color-status-danger-foreground); }

.pxd-disclosure-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--pxd-space-inline-tight);
  min-height: var(--polyxd-control);
  padding: 0;
  border: 0;
  background: none;
  color: var(--pxd-color-text-link);
  cursor: pointer;
}
.pxd-disclosure-content {
  padding: var(--pxd-space-inset-compact) 0 0 var(--pxd-space-inset-default);
  border-left: var(--pxd-border-width-strong) solid var(--pxd-color-border-default);
}

.pxd-views-list {
  display: flex;
  gap: var(--pxd-space-inline-tight);
  border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  overflow-x: auto;
}
.pxd-views-tab {
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-default);
  border: 0;
  border-bottom: var(--pxd-border-width-strong) solid transparent;
  background: none;
  color: var(--pxd-color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.pxd-views-tab[data-state="active"] {
  color: var(--pxd-color-text-default);
  border-bottom-color: var(--pxd-color-action-primary-background);
}
.pxd-views-panel {
  padding-top: var(--pxd-space-stack-default);
}

/* Content */
.pxd-metric {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
  padding: var(--pxd-space-inset-default);
  background: var(--pxd-color-surface-subtle);
  border-radius: var(--pxd-radius-default);
}
.pxd-metric-value {
  font-family: var(--pxd-type-numeric-display-family);
  font-size: var(--pxd-type-numeric-display-size);
  font-weight: var(--pxd-type-numeric-display-weight);
  line-height: var(--pxd-type-numeric-display-line-height);
  letter-spacing: var(--pxd-type-numeric-display-letter-spacing);
  font-variant-numeric: tabular-nums;
}
/* Change pills use status pairs, which the token contract guarantees at 4.5:1 for text. */
.pxd-metric-change {
  align-self: flex-start;
  padding: 0 var(--pxd-space-inline-default);
  border-radius: var(--pxd-radius-full);
  font-weight: 600;
}
.pxd-metric-change.pxd-data-positive { background: var(--pxd-color-status-success-background); color: var(--pxd-color-status-success-foreground); }
.pxd-metric-change.pxd-data-negative { background: var(--pxd-color-status-danger-background); color: var(--pxd-color-status-danger-foreground); }
.pxd-metric-change.pxd-data-neutral { background: var(--pxd-color-surface-default); color: var(--pxd-color-text-muted); }

.pxd-detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-detail-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) 2fr;
  gap: var(--pxd-space-inline-default);
  padding: var(--pxd-space-stack-default) 0;
  border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
}
.pxd-detail-row dt {
  color: var(--pxd-color-text-muted);
}
.pxd-detail-row dd {
  font-variant-numeric: tabular-nums;
}
@container pxd (width < 30rem) {
  .pxd-detail-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.pxd-collection {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-collection-list {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
}
.pxd-collection-item {
  display: flex;
  align-items: flex-start;
  gap: var(--pxd-space-inline-default);
}
.pxd-collection-content {
  flex: 1;
  min-width: 0;
}
.pxd-collection-select {
  width: 20px;
  height: 20px;
  margin-top: var(--pxd-space-inset-default);
  accent-color: var(--pxd-color-action-primary-background);
}

.pxd-table-wrap {
  overflow-x: auto;
}
.pxd-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.pxd-table caption {
  text-align: left;
  padding-bottom: var(--pxd-space-stack-default);
  color: var(--pxd-color-text-muted);
}
.pxd-table th,
.pxd-table td {
  text-align: left;
  padding: var(--pxd-space-stack-default) var(--pxd-space-inline-default);
  border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
}
.pxd-table th[scope="row"] {
  font-weight: 600;
}
.pxd-table thead th {
  background: var(--pxd-color-surface-subtle);
}
.pxd-table .pxd-num {
  text-align: right;
}
.pxd-table-action {
  text-align: right;
}
/* Compact: each row becomes a stacked card of label/value pairs. */
@container pxd (width < 36rem) {
  .pxd-table-wrap .pxd-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .pxd-table-wrap .pxd-table tbody tr {
    display: block;
    padding: var(--pxd-space-inset-compact) 0;
    border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-strong);
  }
  .pxd-table-wrap .pxd-table tbody :is(td, th) {
    display: flex;
    justify-content: space-between;
    gap: var(--pxd-space-inline-default);
    border: 0;
    padding: 4px 0;
    text-align: right;
  }
  .pxd-table-wrap .pxd-table tbody :is(td, th)[data-label]::before {
    content: attr(data-label);
    color: var(--pxd-color-text-muted);
    font-weight: 400;
    text-align: left;
  }
  .pxd-table-wrap .pxd-table tbody .pxd-table-action {
    justify-content: flex-end;
  }
}

.pxd-chart {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-chart figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pxd-chart-svg {
  width: 100%;
  height: auto;
  max-height: 16rem;
}
.pxd-chart-bar {
  height: 2.5rem;
}
.pxd-chart-axis text {
  fill: var(--pxd-color-text-muted);
  font-size: 12px;
  font-family: var(--pxd-type-label-small-family);
}
.pxd-chart-grid {
  stroke: var(--pxd-color-border-default);
}
.pxd-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pxd-space-inline-loose);
  font-size: var(--pxd-type-body-small-size);
}
.pxd-chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--pxd-space-inline-tight);
}
.pxd-chart-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.pxd-chart-data summary,
.pxd-chart-data {
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-link);
  cursor: pointer;
}
.pxd-chart-data[open] .pxd-table {
  color: var(--pxd-color-text-default);
  margin-top: var(--pxd-space-stack-tight);
}

.pxd-media {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: var(--pxd-radius-default);
  background: var(--pxd-color-surface-subtle);
}
.pxd-media-square { aspect-ratio: 1; }
.pxd-media-landscape { aspect-ratio: 16 / 9; }
.pxd-media-portrait { aspect-ratio: 3 / 4; }
.pxd-media-placeholder.pxd-media-auto { aspect-ratio: 16 / 9; }
.pxd-card:has(.pxd-media-square) {
  flex-direction: row;
}
.pxd-card:has(.pxd-media-square) .pxd-card-media {
  flex: 0 0 5rem;
}

.pxd-status {
  display: flex;
  gap: var(--pxd-space-inline-default);
  padding: var(--pxd-space-inset-default);
  border-radius: var(--pxd-radius-default);
  background: var(--pxd-color-surface-subtle);
}
.pxd-status-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--pxd-size-icon-default);
  height: var(--pxd-size-icon-default);
  border-radius: var(--pxd-radius-full);
  font-weight: 700;
  font-size: 14px;
  color: var(--pxd-color-surface-default);
  background: var(--pxd-color-text-muted);
}
.pxd-status-body {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-status-action {
  margin-top: var(--pxd-space-stack-tight);
}
.pxd-status-info { background: var(--pxd-color-status-info-background); color: var(--pxd-color-status-info-foreground); }
.pxd-status-success { background: var(--pxd-color-status-success-background); color: var(--pxd-color-status-success-foreground); }
.pxd-status-warning { background: var(--pxd-color-status-warning-background); color: var(--pxd-color-status-warning-foreground); }
.pxd-status-error { background: var(--pxd-color-status-danger-background); color: var(--pxd-color-status-danger-foreground); }
.pxd-status-info .pxd-status-icon { background: var(--pxd-color-status-info-emphasis); }
.pxd-status-success .pxd-status-icon { background: var(--pxd-color-status-success-emphasis); }
.pxd-status-warning .pxd-status-icon { background: var(--pxd-color-status-warning-emphasis); }
.pxd-status-error .pxd-status-icon { background: var(--pxd-color-status-danger-emphasis); }
.pxd-status-empty {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--pxd-space-inset-comfortable);
  background: none;
  border: var(--pxd-border-width-default) dashed var(--pxd-color-border-default);
}
.pxd-status-empty .pxd-status-body {
  align-items: center;
}
.pxd-status-empty .pxd-status-icon {
  background: var(--pxd-color-surface-subtle);
  color: var(--pxd-color-text-muted);
}
.pxd-spinner {
  flex: none;
  width: var(--pxd-size-icon-default);
  height: var(--pxd-size-icon-default);
  border-radius: 50%;
  border: 3px solid var(--pxd-color-border-default);
  border-top-color: var(--pxd-color-action-primary-background);
  animation: pxd-spin 800ms linear infinite;
}
@keyframes pxd-spin {
  to { transform: rotate(360deg); }
}

/* Inputs */
.pxd-form {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-loose);
}
.pxd-field {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
/* Not the danger colour: that one is only guaranteed 3:1, which is the floor for a graphic, and
   this is a character someone reads. What marks the field is the mark's presence and the legend
   that explains it, not its redness. */
.pxd-required {
  margin-inline-start: 0.125em;
  font-weight: 400;
  color: var(--pxd-color-text-default);
}
.pxd-required-legend {
  margin: 0;
  color: var(--pxd-color-text-muted);
  font-size: var(--pxd-type-body-small-size);
}
.pxd-input {
  width: 100%;
  max-width: 32rem;
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-compact);
  background: var(--pxd-color-surface-default);
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-strong);
  border-radius: var(--pxd-radius-small);
  transition: border-color var(--pxd-motion-duration-short) var(--pxd-motion-easing-standard);
}
textarea.pxd-input {
  padding: var(--pxd-space-inset-compact);
  resize: vertical;
}
.pxd-input:focus-visible {
  outline-offset: 0;
  border-color: var(--pxd-color-border-focus);
}
.pxd-input:user-invalid {
  border-color: var(--pxd-color-status-danger-emphasis);
  border-width: var(--pxd-border-width-strong);
}
.pxd-input-adorned {
  position: relative;
  max-width: 16rem;
}
.pxd-input-prefix {
  position: absolute;
  left: var(--pxd-space-inset-compact);
  top: 50%;
  transform: translateY(-50%);
  color: var(--pxd-color-text-muted);
}
.pxd-input-adorned .pxd-input {
  padding-left: calc(var(--pxd-space-inset-compact) + 1.25em);
}
.pxd-input-date {
  max-width: 16rem;
}
.pxd-date-range {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pxd-space-inline-default);
}
.pxd-date-range label {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}

.pxd-choice-list {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-choice-scroll {
  max-height: 16rem;
  overflow-y: auto;
  padding: var(--pxd-space-inset-compact);
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  border-radius: var(--pxd-radius-small);
}
.pxd-choice-search {
  max-width: 20rem;
}
.pxd-choice-option {
  display: flex;
  align-items: flex-start;
  gap: var(--pxd-space-inline-default);
}
.pxd-option-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pxd-option-text .pxd-option-description {
  margin-top: calc(var(--pxd-space-stack-tight) * -1);
  padding-bottom: var(--pxd-space-stack-tight);
}
/* The label is part of the target, and fills the row up to the pack's minimum target height. */
.pxd-choice-option label,
.pxd-toggle-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--polyxd-control);
  cursor: pointer;
}
.pxd-choice-option .pxd-radio,
.pxd-choice-option .pxd-checkbox {
  margin-top: calc((var(--pxd-size-target-min) - 24px) / 2);
}
/* 24px is the smallest box any control here is drawn at: below that, WCAG 2.5.8 passes only on
   spacing, which depends on the pack's scale rather than on the component. */
.pxd-radio,
.pxd-checkbox {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  padding: 0;
  border: var(--pxd-border-width-strong) solid var(--pxd-color-border-strong);
  background: var(--pxd-color-surface-default);
  cursor: pointer;
}
.pxd-radio {
  border-radius: 50%;
}
.pxd-checkbox {
  border-radius: var(--pxd-radius-small);
}
.pxd-radio[data-state="checked"],
.pxd-checkbox[data-state="checked"] {
  border-color: var(--pxd-color-action-primary-background);
}
.pxd-checkbox[data-state="checked"] {
  background: var(--pxd-color-action-primary-background);
  color: var(--pxd-color-action-primary-foreground);
}
.pxd-checkbox-indicator {
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}
.pxd-radio-indicator {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pxd-color-action-primary-background);
}
.pxd-segmented {
  display: inline-flex;
  flex-wrap: nowrap;
  align-self: flex-start;
  max-width: 100%;
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-strong);
  border-radius: var(--pxd-radius-large);
  overflow: hidden;
}
.pxd-segment {
  flex: 1 1 auto;
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-default);
  line-height: 1.2;
  border: 0;
  border-left: var(--pxd-border-width-default) solid var(--pxd-color-border-strong);
  background: var(--pxd-color-surface-default);
  cursor: pointer;
}
.pxd-segment:first-child {
  border-left: 0;
}
.pxd-segment[data-state="checked"] {
  background: var(--pxd-color-selection-background);
  color: var(--pxd-color-selection-foreground);
}
.pxd-segment[data-state="checked"]::before {
  content: "✓ ";
}

.pxd-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--pxd-space-inline-default);
}
.pxd-toggle > .pxd-switch,
.pxd-toggle > .pxd-checkbox {
  margin-top: calc((var(--pxd-size-target-min) - 24px) / 2);
}
.pxd-toggle-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pxd-toggle-text .pxd-field-help {
  margin-top: calc(var(--pxd-space-stack-tight) * -1);
}
.pxd-switch {
  flex: none;
  position: relative;
  width: 44px;
  height: 24px;
  padding: 0;
  border-radius: var(--pxd-radius-full);
  border: var(--pxd-border-width-strong) solid var(--pxd-color-border-strong);
  background: var(--pxd-color-surface-subtle);
  cursor: pointer;
  transition: background var(--pxd-motion-duration-short) var(--pxd-motion-easing-standard);
}
.pxd-switch[data-state="checked"] {
  background: var(--pxd-color-action-primary-background);
  border-color: var(--pxd-color-action-primary-background);
}
.pxd-switch-thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pxd-color-border-strong);
  transform: translateX(2px);
  transition: transform var(--pxd-motion-duration-short) var(--pxd-motion-easing-standard);
}
.pxd-switch[data-state="checked"] .pxd-switch-thumb {
  background: var(--pxd-color-action-primary-foreground);
  transform: translateX(22px);
}

.pxd-range-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 32rem;
}
.pxd-range-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pxd-slider {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--polyxd-control);
  max-width: 32rem;
  touch-action: none;
}
.pxd-slider-track {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: var(--pxd-radius-full);
  background: var(--pxd-color-border-default);
}
.pxd-slider-range {
  position: absolute;
  height: 100%;
  border-radius: inherit;
  background: var(--pxd-color-action-primary-background);
}
.pxd-slider-thumb {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pxd-color-action-primary-background);
  box-shadow: var(--pxd-shadow-raised);
  cursor: grab;
}
.pxd-range-bounds {
  display: flex;
  justify-content: space-between;
  max-width: 32rem;
}

/* Actions */
.pxd-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pxd-space-inline-tight);
  min-height: var(--polyxd-control);
  min-width: var(--pxd-size-target-min);
  padding: 0 var(--pxd-space-inset-default);
  border-radius: var(--pxd-radius-control);
  border: var(--pxd-border-width-default) solid transparent;
  cursor: pointer;
  transition: background var(--pxd-motion-duration-short) var(--pxd-motion-easing-standard);
}
.pxd-button:disabled {
  opacity: var(--pxd-opacity-state-disabled);
  cursor: not-allowed;
}
.pxd-button-primary {
  background: var(--pxd-color-action-primary-background);
  color: var(--pxd-color-action-primary-foreground);
}
.pxd-button-secondary {
  background: var(--pxd-color-action-secondary-background);
  color: var(--pxd-color-action-secondary-foreground);
  border-color: var(--pxd-color-action-secondary-border);
}
.pxd-button-tertiary {
  background: transparent;
  color: var(--pxd-color-text-link);
  padding: 0 var(--pxd-space-inset-compact);
}
.pxd-button-danger {
  background: var(--pxd-color-action-danger-background);
  color: var(--pxd-color-action-danger-foreground);
  border-color: transparent;
}
.pxd-button-primary:not(:disabled):hover,
.pxd-button-danger:not(:disabled):hover {
  filter: brightness(calc(1 - var(--pxd-opacity-state-hover)));
}
.pxd-button-secondary:not(:disabled):hover,
.pxd-button-tertiary:not(:disabled):hover {
  background: color-mix(in srgb, currentColor calc(var(--pxd-opacity-state-hover) * 100%), transparent);
}
.pxd-button-secondary:not(:disabled):hover {
  background: color-mix(in srgb, var(--pxd-color-action-secondary-foreground) calc(var(--pxd-opacity-state-hover) * 100%), var(--pxd-color-action-secondary-background));
}
/* Wide: primary sits at the end of the row (DOM order is importance order). Compact: stacked, primary first. */
.pxd-action-bar {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  flex-wrap: wrap-reverse;
  gap: var(--pxd-space-inline-default);
}
@container pxd (width < 30rem) {
  .pxd-action-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
/* A dialog's footer is the one place design systems disagree about layout rather than about
   values: Carbon's runs the full width of the dialog in equal halves, Material's and Ant's sit
   inline at the trailing edge. A pack sets these three variables in its manifest; the defaults
   here are the inline footer, so a pack that says nothing keeps it. */
.pxd-dialog > .pxd-action-bar {
  gap: var(--pxd-layout-action-gap, var(--pxd-space-inline-default));
  margin: var(--pxd-layout-action-bleed, 0);
}
.pxd-dialog > .pxd-action-bar > .pxd-button {
  flex: var(--pxd-layout-action-item, 0 0 auto);
}

/* Flow */
.pxd-steps {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
}
.pxd-steps-list {
  display: flex;
  gap: var(--pxd-space-inline-tight);
}
.pxd-steps-list li {
  flex: 1;
  padding-top: var(--pxd-space-stack-tight);
  border-top: 4px solid var(--pxd-color-border-default);
  color: var(--pxd-color-text-muted);
  font-size: var(--pxd-type-label-small-size);
}
.pxd-steps-list li.pxd-step-done {
  border-top-color: var(--pxd-color-action-primary-background);
}
.pxd-steps-list li[aria-current="step"] {
  border-top-color: var(--pxd-color-action-primary-background);
  color: var(--pxd-color-text-default);
  font-weight: 600;
}
.pxd-steps-content {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-loose);
}

.pxd-portal {
  display: contents;
}
.pxd-overlay {
  position: fixed;
  inset: 0;
  background: var(--pxd-color-scrim);
  z-index: 10;
}
.pxd-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 11;
  transform: translate(-50%, -50%);
  width: min(32rem, calc(100% - 2 * var(--pxd-space-inset-default)));
  max-height: calc(100% - 2 * var(--pxd-space-inset-default));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
  padding: var(--pxd-space-inset-comfortable);
  background: var(--pxd-color-surface-overlay);
  color: var(--pxd-color-text-default);
  border-radius: var(--pxd-radius-large);
  box-shadow: var(--pxd-shadow-overlay);
}
/* A confirmation that is the whole surface sits inline, centred in the surface. */
.pxd-dialog-inline {
  position: static;
  transform: none;
  margin: var(--pxd-space-stack-loose) auto;
  max-height: none;
}
/* Danger is shown by a graphic accent; title text stays in the text colour (4.5:1 guaranteed). */
.pxd-dialog-destructive {
  border-top: 4px solid var(--pxd-color-status-danger-emphasis);
}
.pxd-dialog-description {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-dialog-consequence {
  font-weight: 600;
}
.pxd-dialog .pxd-action-bar {
  margin-top: var(--pxd-space-stack-tight);
}

.pxd-comparison {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
}
.pxd-comparison-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--pxd-space-inline-loose);
}
.pxd-comparison-item {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
  padding: var(--pxd-space-inset-default);
  background: var(--pxd-color-surface-raised);
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  border-radius: var(--pxd-radius-default);
}
.pxd-comparison-item.pxd-recommended {
  border: var(--pxd-border-width-strong) solid var(--pxd-color-action-primary-background);
}
.pxd-comparison-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pxd-space-inline-default);
}
.pxd-comparison-item .pxd-detail-row {
  grid-template-columns: 1fr;
  gap: 2px;
  padding: var(--pxd-space-stack-tight) 0;
}
.pxd-comparison-item .pxd-button {
  margin-top: auto;
}
.pxd-best {
  margin-left: var(--pxd-space-inline-tight);
  padding: 0 var(--pxd-space-inline-tight);
  border-radius: var(--pxd-radius-small);
  background: var(--pxd-color-status-success-background);
  color: var(--pxd-color-status-success-foreground);
  font-weight: 600;
}

.pxd-unknown {
  padding: var(--pxd-space-inset-compact);
  border: 1px dashed var(--pxd-color-status-danger-emphasis);
  background: var(--pxd-color-status-danger-background);
  color: var(--pxd-color-status-danger-foreground);
}

@media (prefers-reduced-motion: reduce) {
  .pxd-surface *,
  .pxd-surface *::before,
  .pxd-surface *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

/* ---- Batch 1: building blocks from the flow designs (design/flows) ---- */

/* Search: a pill with the icon inside; the label is visually hidden but remains the accessible name. */
.pxd-search {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  min-height: calc(var(--polyxd-control) + 8px);
  padding: 0 var(--pxd-space-inset-default);
  border-radius: var(--pxd-radius-full);
  background: var(--pxd-color-surface-subtle);
  color: var(--pxd-color-text-muted);
}
.pxd-search:focus-within {
  outline: var(--pxd-focus-ring-width) solid var(--pxd-color-border-focus);
  outline-offset: var(--pxd-focus-ring-offset);
}
.pxd-search-compact {
  min-height: var(--polyxd-control);
}
.pxd-search-input {
  flex: 1;
  min-width: 0;
  min-height: var(--polyxd-control);
  border: 0;
  background: transparent;
  color: var(--pxd-color-text-default);
  font-size: var(--pxd-type-body-default-size);
}
.pxd-search-input:focus-visible {
  outline: none;
}
.pxd-search-input::placeholder {
  color: var(--pxd-color-text-muted);
}

/* Hero amount: the one number a surface is about. */
.pxd-hero-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pxd-space-stack-tight);
  padding: var(--pxd-space-stack-loose) 0 var(--pxd-space-stack-default);
  text-align: center;
}
.pxd-hero-label {
  color: var(--pxd-color-text-muted);
  font-size: var(--pxd-type-body-small-size);
}
.pxd-hero-input {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
}
.pxd-hero-symbol {
  font-size: calc(var(--pxd-type-numeric-display-size) * 1.1);
  color: var(--pxd-color-text-muted);
}
.pxd-hero-value {
  min-width: 1ch;
  max-width: 100%;
  border: 0;
  border-bottom: var(--pxd-border-width-strong) solid transparent;
  background: transparent;
  color: var(--pxd-color-text-default);
  font-family: var(--pxd-type-numeric-display-family);
  font-size: calc(var(--pxd-type-numeric-display-size) * 1.6);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  field-sizing: content;
}
.pxd-hero-value:focus-visible {
  outline: none;
  border-bottom-color: var(--pxd-color-border-focus);
}
.pxd-hero-help {
  max-width: none;
}

/* Chips: single choice (radio) and multiple (checkbox), for a few short options. */
.pxd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pxd-space-inline-default);
}
.pxd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-default);
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-strong);
  border-radius: var(--pxd-radius-control);
  background: transparent;
  color: var(--pxd-color-text-default);
  font-family: var(--pxd-type-label-default-family);
  font-size: var(--pxd-type-label-default-size);
  font-weight: var(--pxd-type-label-default-weight);
  cursor: pointer;
}
.pxd-chip[data-state="checked"] {
  border-color: transparent;
  background: var(--pxd-color-selection-background);
  color: var(--pxd-color-selection-foreground);
}
.pxd-chip-check {
  display: inline-flex;
}

/* Avatars: initials on a tone chosen per name, from contrast-guaranteed pairs. */
.pxd-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  font-weight: 600;
}
.pxd-avatar-primary { background: var(--pxd-color-selection-background); color: var(--pxd-color-selection-foreground); }
.pxd-avatar-secondary { background: var(--pxd-color-surface-subtle); color: var(--pxd-color-text-default); }
.pxd-avatar-tertiary { background: var(--pxd-color-status-info-background); color: var(--pxd-color-status-info-foreground); }
.pxd-avatar-success { background: var(--pxd-color-status-success-background); color: var(--pxd-color-status-success-foreground); }
.pxd-avatar-warning { background: var(--pxd-color-status-warning-background); color: var(--pxd-color-status-warning-foreground); }

/* People picker: recent faces, then a list. */
.pxd-people-group {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
}
.pxd-people-recent {
  display: flex;
  gap: var(--pxd-space-inline-default);
  overflow-x: auto;
  padding: 2px;
}
.pxd-person-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
  flex: none;
  padding: 6px 0;
  border: 0;
  border-radius: var(--pxd-radius-default);
  background: transparent;
  color: var(--pxd-color-text-default);
  cursor: pointer;
}
.pxd-person-tile[data-state="checked"] .pxd-avatar {
  box-shadow:
    0 0 0 var(--pxd-border-width-strong) var(--pxd-color-surface-default),
    0 0 0 calc(var(--pxd-border-width-strong) * 2) var(--pxd-color-action-primary-background);
}
.pxd-person-face {
  position: relative;
  display: inline-flex;
}
.pxd-person-tick {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--pxd-color-surface-default);
  background: var(--pxd-color-action-primary-background);
  color: var(--pxd-color-action-primary-foreground);
}
.pxd-person-name {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--pxd-type-label-small-size);
}
.pxd-people-list {
  display: flex;
  flex-direction: column;
}
.pxd-person-row {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-loose);
  min-height: calc(var(--polyxd-control) + 8px);
  padding: 6px var(--pxd-space-inset-compact);
  border: 0;
  border-radius: var(--pxd-radius-default);
  background: transparent;
  color: var(--pxd-color-text-default);
  text-align: left;
  cursor: pointer;
}
.pxd-person-row:hover {
  background: color-mix(in srgb, var(--pxd-color-text-default) calc(var(--pxd-opacity-state-hover) * 100%), transparent);
}
.pxd-person-row[data-state="checked"] {
  background: var(--pxd-color-selection-background);
  color: var(--pxd-color-selection-foreground);
}
.pxd-person-row[data-state="checked"] .pxd-option-description {
  color: inherit;
}
.pxd-person-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: var(--pxd-type-body-default-size);
}
.pxd-person-check {
  display: inline-flex;
}

/* Range: two thumbs and min/max fields. */
.pxd-range-fields {
  display: flex;
  align-items: flex-end;
  gap: var(--pxd-space-inline-default);
  max-width: 32rem;
}
.pxd-range-fields label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
  font-size: var(--pxd-type-label-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-range-fields > span {
  padding-bottom: calc(var(--pxd-size-target-min) / 2 - 10px);
  color: var(--pxd-color-text-muted);
}

/* Grid collections: visual items side by side. */
.pxd-collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--pxd-space-stack-loose) var(--pxd-space-inline-default);
}
@container pxd (width >= 36rem) {
  .pxd-collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: var(--pxd-space-stack-loose) var(--pxd-space-inline-loose);
  }
}
.pxd-collection-grid .pxd-card {
  flex-direction: column !important;
  box-shadow: none;
  background: transparent;
  border: 0;
}
.pxd-collection-grid .pxd-card-media {
  flex: none !important;
}
.pxd-collection-grid .pxd-card-media .pxd-media {
  aspect-ratio: 1;
  border-radius: var(--pxd-radius-default);
}
.pxd-collection-grid .pxd-card-body {
  padding: var(--pxd-space-stack-tight) 2px 0;
}

/* Receipt: people read amounts from the right. */
.pxd-receipt dl {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
  padding: var(--pxd-space-inset-default);
  border-radius: var(--pxd-radius-default);
  background: var(--pxd-color-surface-subtle);
}
.pxd-receipt .pxd-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--pxd-space-inline-loose);
  padding: 0;
  border: 0;
}
.pxd-receipt .pxd-detail-row dd {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pxd-receipt .pxd-free {
  color: var(--pxd-color-status-success-foreground);
  background: var(--pxd-color-status-success-background);
  padding: 0 var(--pxd-space-inline-tight);
  border-radius: var(--pxd-radius-small);
}
.pxd-receipt .pxd-total {
  margin-top: var(--pxd-space-stack-tight);
  padding-top: var(--pxd-space-stack-default);
  border-top: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  font-weight: 600;
}
.pxd-receipt .pxd-total dt {
  color: var(--pxd-color-text-default);
}
@container pxd (width < 30rem) {
  .pxd-receipt .pxd-detail-row {
    flex-direction: row;
  }
}

/* Confirmation: who it's for, the amount, what happens. */
.pxd-dialog-subject {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
}
.pxd-dialog-subject-title {
  font-weight: 600;
}
.pxd-dialog-subject-sub {
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-dialog-amount {
  font-family: var(--pxd-type-numeric-display-family);
  font-size: calc(var(--pxd-type-numeric-display-size) * 1.3);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.pxd-dialog-consequence {
  display: flex;
  gap: var(--pxd-space-inline-default);
  align-items: flex-start;
  margin: 0;
  font-weight: 400;
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-dialog-consequence svg {
  flex: none;
  margin-top: 2px;
}
.pxd-consequences {
  display: grid;
  gap: var(--pxd-space-stack-default);
}
@container pxd (width >= 40rem) {
  .pxd-consequences {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.pxd-consequences li {
  display: flex;
  gap: var(--pxd-space-inline-default);
  align-items: flex-start;
}
.pxd-consequence-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--pxd-radius-default);
  background: var(--pxd-color-surface-subtle);
  color: var(--pxd-color-text-muted);
}
.pxd-consequence-title,
.pxd-consequence-detail {
  display: block;
}
.pxd-consequence-detail {
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}

/* On phones, a form's actions stay within reach at the bottom, full width. */
@container pxd (width < 30rem) {
  .pxd-form > .pxd-action-bar,
  .pxd-steps-content > .pxd-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 0 calc(var(--pxd-space-inset-comfortable) * -1) calc(var(--pxd-space-inset-comfortable) * -1);
    padding: var(--pxd-space-inset-compact) var(--pxd-space-inset-comfortable) var(--pxd-space-inset-comfortable);
    background: var(--pxd-color-surface-default);
    border-top: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  }
  .pxd-form > .pxd-action-bar .pxd-button,
  .pxd-steps-content > .pxd-action-bar .pxd-button {
    width: 100%;
  }
}

/* ---- Batch 2: layouts and patterns from the flow designs ---- */

/* Empty states: an icon tile, encouraging copy, up to two actions. */
.pxd-status-empty {
  border: 0;
  padding: var(--pxd-space-stack-loose) var(--pxd-space-inset-comfortable);
}
.pxd-status-empty .pxd-status-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--pxd-radius-large);
}
.pxd-status-empty .pxd-status-action .pxd-action-bar {
  justify-content: center;
}

/* Undo: a snackbar at the bottom of the surface. */
.pxd-snackbar {
  position: sticky;
  bottom: var(--pxd-space-inset-default);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  width: fit-content;
  max-width: 100%;
  margin: var(--pxd-space-stack-default) auto 0;
  padding: var(--pxd-space-inset-compact) var(--pxd-space-inset-compact) var(--pxd-space-inset-compact) var(--pxd-space-inset-default);
  border-radius: var(--pxd-radius-default);
  background: var(--pxd-color-text-default);
  color: var(--pxd-color-surface-default);
  box-shadow: var(--pxd-shadow-overlay);
}
.pxd-snackbar-text {
  margin: 0;
}
.pxd-snackbar .pxd-button {
  background: transparent;
  color: var(--pxd-color-surface-default);
  border-color: transparent;
  text-decoration: underline;
}

/* Progress on a card. */
.pxd-progress {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
}
.pxd-progress-track {
  flex: 1;
  height: 6px;
  border-radius: var(--pxd-radius-full);
  background: var(--pxd-color-border-default);
  overflow: hidden;
}
.pxd-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--pxd-color-action-primary-background);
}
.pxd-progress-label {
  flex: none;
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Form with a summary beside it (wide) or before the action (compact). */
@container pxd (width >= 48rem) {
  .pxd-form-with-aside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    grid-template-areas: "fields aside" "actions aside";
    align-items: start;
    column-gap: var(--pxd-space-inline-loose);
    row-gap: var(--pxd-space-stack-loose);
  }
  .pxd-form-with-aside > .pxd-form-fields { grid-area: fields; }
  .pxd-form-with-aside > .pxd-action-bar { grid-area: actions; }
  .pxd-form-with-aside > .pxd-form-aside {
    grid-area: aside;
    position: sticky;
    top: var(--pxd-space-inset-default);
  }
}
.pxd-form-aside {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
}

/* Comparison: one recommendation with its reason, grouped attributes, yes/no marks. */
.pxd-recommendation {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--pxd-space-stack-tight);
  margin: 0;
}
.pxd-recommendation-reason {
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-comparison-group-label {
  margin: 0;
  padding-top: var(--pxd-space-stack-tight);
  font-family: var(--pxd-type-label-small-family);
  font-size: var(--pxd-type-label-small-size);
  font-weight: 600;
  color: var(--pxd-color-text-muted);
}
.pxd-yes,
.pxd-no {
  display: inline-flex;
  vertical-align: middle;
}
.pxd-yes {
  color: var(--pxd-color-text-default);
}
.pxd-no {
  color: var(--pxd-color-text-muted);
}

/* Filter panel: sidebar on wide, a sheet on compact. */
.pxd-filter-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: var(--pxd-space-inline-loose);
  align-items: start;
}
.pxd-filter-sidebar {
  position: sticky;
  top: var(--pxd-space-inset-default);
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
}
.pxd-filter-title {
  margin: 0;
  font-family: var(--pxd-type-title-item-family);
  font-size: var(--pxd-type-title-item-size);
  font-weight: var(--pxd-type-title-item-weight);
}
.pxd-filter-results {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
  min-width: 0;
}
.pxd-filter-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--pxd-space-inline-default);
}
.pxd-filter-count {
  margin: 0;
  color: var(--pxd-color-text-muted);
  font-size: var(--pxd-type-body-small-size);
}
.pxd-filter-trigger {
  background: transparent;
}
.pxd-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pxd-filter-chip {
  border-color: transparent;
  background: var(--pxd-color-selection-background);
  color: var(--pxd-color-selection-foreground);
}
.pxd-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  display: flex;
  flex-direction: column;
  max-height: 85%;
  background: var(--pxd-color-surface-overlay);
  color: var(--pxd-color-text-default);
  border-radius: var(--pxd-radius-large) var(--pxd-radius-large) 0 0;
  box-shadow: var(--pxd-shadow-overlay);
}
.pxd-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pxd-space-inset-compact) var(--pxd-space-inset-compact) 0 var(--pxd-space-inset-default);
}
.pxd-sheet-title {
  margin: 0;
  font-family: var(--pxd-type-title-section-family);
  font-size: var(--pxd-type-title-section-size);
  font-weight: var(--pxd-type-title-section-weight);
}
.pxd-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--pxd-space-inset-default);
}
.pxd-sheet-footer {
  display: flex;
  gap: var(--pxd-space-inline-default);
  padding: var(--pxd-space-inset-compact) var(--pxd-space-inset-default) var(--pxd-space-inset-default);
  border-top: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
}
.pxd-sheet-footer .pxd-button {
  flex: 1;
}
.pxd-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--pxd-size-target-min);
  height: var(--polyxd-control);
  border: 0;
  border-radius: var(--pxd-radius-control);
  background: transparent;
  color: var(--pxd-color-text-default);
  cursor: pointer;
}

/* ---- Batch 4: dense B2B layouts (app shell, page header, data tables) ---- */

/* Density comes from Design Direction. It sets row height and how tight rows are packed;
   touch targets keep their minimum, so compact is for pointer surfaces. */
.pxd-surface {
  --polyxd-row-height: 40px;
  --polyxd-row-pad: var(--pxd-space-inset-compact);
  /* Space between two things that belong together, and between two separate questions. */
  --polyxd-stack: var(--pxd-space-stack-default);
  --polyxd-stack-apart: var(--pxd-space-stack-loose);
  --polyxd-inset: var(--pxd-space-inset-comfortable);
  --polyxd-control: var(--pxd-size-target-min);
}
.pxd-surface[data-pxd-density="compact"] {
  --polyxd-row-height: 32px;
  --polyxd-row-pad: var(--pxd-space-inline-default);
  --polyxd-stack: var(--pxd-space-stack-tight);
  --polyxd-stack-apart: var(--pxd-space-stack-default);
  --polyxd-inset: var(--pxd-space-inset-default);
  /* Controls shrink only where there is a pointer; touch keeps its 44px floor. */
  --polyxd-control: max(36px, calc(var(--pxd-size-target-min) - 12px));
}
.pxd-surface[data-pxd-density="spacious"] {
  --polyxd-row-height: 48px;
  --polyxd-row-pad: var(--pxd-space-inset-default);
  --polyxd-stack: var(--pxd-space-stack-loose);
  --polyxd-stack-apart: var(--pxd-space-stack-section);
  --polyxd-inset: var(--pxd-space-inset-comfortable);
  --polyxd-control: calc(var(--pxd-size-target-min) + 4px);
}
@media (pointer: coarse) {
  .pxd-surface[data-pxd-density="compact"] {
    --polyxd-control: max(44px, calc(var(--pxd-size-target-min) - 4px));
  }
}

/* App shell: navigation beside the page. */
.pxd-surface-with-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--pxd-space-inline-loose);
}
.pxd-surface-main {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-loose);
  min-width: 0;
}
.pxd-nav {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-default);
  min-width: 12rem;
}
.pxd-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pxd-nav-group-label {
  margin: 0 0 var(--pxd-space-stack-tight);
  padding: 0 var(--pxd-space-inline-default);
  font-family: var(--pxd-type-label-small-family);
  font-size: var(--pxd-type-label-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-nav-item {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  width: 100%;
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-compact);
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 var(--pxd-radius-default) var(--pxd-radius-default) 0;
  background: transparent;
  color: var(--pxd-color-text-muted);
  font-family: var(--pxd-type-label-default-family);
  font-size: var(--pxd-type-label-default-size);
  text-align: left;
  cursor: pointer;
}
.pxd-nav-item:hover {
  background: color-mix(in srgb, var(--pxd-color-text-default) calc(var(--pxd-opacity-state-hover) * 100%), transparent);
}
.pxd-nav-current {
  border-left-color: var(--pxd-color-action-primary-background);
  background: var(--pxd-color-surface-subtle);
  color: var(--pxd-color-text-default);
  font-weight: 600;
}
.pxd-nav-label {
  flex: 1;
}
.pxd-nav-badge {
  flex: none;
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--pxd-radius-full);
  background: var(--pxd-color-status-danger-background);
  color: var(--pxd-color-status-danger-foreground);
  font-size: var(--pxd-type-label-small-size);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pxd-nav-drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 11;
  width: min(20rem, 85%);
  padding-bottom: var(--pxd-space-inset-default);
  overflow-y: auto;
  background: var(--pxd-color-surface-overlay);
  box-shadow: var(--pxd-shadow-overlay);
}

/* Page header: where you are, what state it's in, what you can do. */
.pxd-page-header {
  display: flex;
  flex-direction: column;
  gap: var(--pxd-space-stack-tight);
}
.pxd-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pxd-space-inline-default);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-breadcrumbs li + li::before {
  content: "/";
  margin-right: var(--pxd-space-inline-default);
  color: var(--pxd-color-text-muted);
}
.pxd-page-header-main {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  flex-wrap: wrap;
}
.pxd-page-header-text {
  flex: 1;
  min-width: 12rem;
}
.pxd-page-header-text .pxd-surface-title {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  flex-wrap: wrap;
  margin: 0;
}
.pxd-surface-subtitle {
  margin: var(--pxd-space-stack-tight) 0 0;
  color: var(--pxd-color-text-muted);
}
.pxd-page-header-actions {
  flex: none;
}
.pxd-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--pxd-color-text-link);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

/* A surface that opens beside what it came from. */
.pxd-surface-panel {
  height: 100%;
  border-left: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  background: var(--pxd-color-surface-default);
}

/* Table: toolbar, saved views, sorting, selection, paging. */
.pxd-table-wrap {
  display: flex;
  flex-direction: column;
  border: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  border-radius: var(--pxd-radius-default);
  overflow: hidden;
}
.pxd-table-views {
  display: flex;
  flex-wrap: wrap;
  border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  background: var(--pxd-color-surface-default);
}
.pxd-table-view {
  display: inline-flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-compact);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--pxd-color-text-muted);
  font-family: var(--pxd-type-label-default-family);
  font-size: var(--pxd-type-label-default-size);
  cursor: pointer;
}
.pxd-table-view-current {
  border-bottom-color: var(--pxd-color-action-primary-background);
  color: var(--pxd-color-text-default);
  font-weight: 600;
}
.pxd-views-tab .pxd-views-count {
  margin-left: var(--pxd-space-inline-default);
}
.pxd-views-count {
  font-size: var(--pxd-type-label-small-size);
  color: var(--pxd-color-text-muted);
  font-variant-numeric: tabular-nums;
}
.pxd-table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  padding: var(--pxd-space-inline-default);
  background: var(--pxd-color-surface-subtle);
  border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
}
.pxd-table-toolbar > .pxd-field {
  flex: 1;
  min-width: 0;
  max-width: 24rem;
}
.pxd-table-toolbar-spacer {
  flex: 1;
}
.pxd-table-bulk {
  background: var(--pxd-color-selection-background);
  color: var(--pxd-color-selection-foreground);
}
.pxd-bulk-count {
  margin: 0;
  flex: 1;
  font-weight: 600;
}
.pxd-table-bulk .pxd-button-tertiary {
  color: inherit;
  border-color: currentColor;
}
.pxd-table-scroll {
  overflow-x: auto;
}
.pxd-table th,
.pxd-table td {
  height: var(--polyxd-row-height);
  padding: 0 var(--polyxd-row-pad);
}
.pxd-table thead th {
  background: var(--pxd-color-surface-subtle);
  white-space: nowrap;
}
.pxd-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--polyxd-control);
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.pxd-table-select {
  width: 3rem;
}
.pxd-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: var(--pxd-border-width-strong) solid var(--pxd-color-border-strong);
  border-radius: var(--pxd-radius-small);
  background: var(--pxd-color-surface-default);
  color: var(--pxd-color-action-primary-foreground);
  cursor: pointer;
}
.pxd-checkbox[data-state="checked"],
.pxd-checkbox[data-state="indeterminate"] {
  border-color: var(--pxd-color-action-primary-background);
  background: var(--pxd-color-action-primary-background);
}
/* Selected rows are marked at the edge, not tinted: link text is only guaranteed
   readable on the default surface. */
.pxd-row-selected > :first-child {
  box-shadow: inset calc(var(--pxd-border-width-strong) + 1px) 0 0 0 var(--pxd-color-action-primary-background);
}
.pxd-entity {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
}
/* In a dense row, the whole row height is the target (WCAG 2.5.8 asks for 24px). */
.pxd-table .pxd-link,
.pxd-row-item .pxd-link {
  display: flex;
  align-items: center;
  min-height: max(var(--polyxd-row-height), 24px);
}
.pxd-row-item .pxd-link {
  min-height: var(--polyxd-control);
}
.pxd-entity-text {
  display: flex;
  flex-direction: column;
}
.pxd-entity-name {
  font-weight: 500;
}
.pxd-entity-secondary {
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-paging {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-loose);
  padding: 0 var(--pxd-space-inline-default);
  min-height: var(--polyxd-control);
  border-top: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  background: var(--pxd-color-surface-subtle);
  font-size: var(--pxd-type-body-small-size);
  flex-wrap: wrap;
}
.pxd-paging-size {
  display: inline-flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  color: var(--pxd-color-text-muted);
}
.pxd-paging-size select {
  min-height: var(--polyxd-control);
  border: 0;
  background: transparent;
  color: var(--pxd-color-text-default);
  font: inherit;
}
.pxd-paging-range {
  margin: 0;
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.pxd-paging-controls {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
}
.pxd-paging-page {
  font-variant-numeric: tabular-nums;
  color: var(--pxd-color-text-muted);
}
.pxd-icon-button:disabled {
  opacity: var(--pxd-opacity-state-disabled);
  cursor: default;
}

/* Row actions menu. */
.pxd-menu {
  z-index: 12;
  min-width: 12rem;
  padding: var(--pxd-space-inline-tight);
  border-radius: var(--pxd-radius-default);
  background: var(--pxd-color-surface-overlay);
  box-shadow: var(--pxd-shadow-overlay);
}
.pxd-menu-item {
  display: flex;
  align-items: center;
  min-height: var(--polyxd-control);
  padding: 0 var(--pxd-space-inset-compact);
  border-radius: var(--pxd-radius-small);
  color: var(--pxd-color-text-default);
  cursor: pointer;
}
.pxd-menu-item[data-highlighted] {
  background: var(--pxd-color-surface-subtle);
  outline: none;
}
.pxd-menu-item-danger {
  color: var(--pxd-color-status-danger-foreground);
}

/* A table on a phone: rows, not columns. */
.pxd-row-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pxd-row-item {
  display: flex;
  align-items: center;
  gap: var(--pxd-space-inline-default);
  padding: var(--pxd-space-inline-default) var(--pxd-space-inset-compact);
  border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
}
.pxd-row-main {
  flex: 1;
  min-width: 0;
}
.pxd-row-details {
  margin: 2px 0 0;
  font-size: var(--pxd-type-body-small-size);
  color: var(--pxd-color-text-muted);
}

/* Record pages: a grid of short fields, activity as a timeline, notices inside the page. */
.pxd-detail-grid dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--pxd-space-stack-default) var(--pxd-space-inline-loose);
}
.pxd-detail-grid .pxd-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  border: 0;
}
.pxd-detail-grid dt {
  font-size: var(--pxd-type-label-small-size);
  color: var(--pxd-color-text-muted);
}
.pxd-timeline .pxd-collection-item {
  position: relative;
  padding-left: var(--pxd-space-inset-default);
  border-left: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
}
.pxd-timeline .pxd-collection-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pxd-color-border-strong);
}
.pxd-status-notice {
  align-items: center;
  border-radius: 0;
  border-left: 4px solid var(--pxd-color-status-warning-emphasis);
}
.pxd-status-notice .pxd-status-body {
  flex: 1;
}
.pxd-status-notice .pxd-status-action {
  margin: 0;
}
.pxd-status-error.pxd-status-notice {
  border-left-color: var(--pxd-color-status-danger-emphasis);
}
.pxd-status-info.pxd-status-notice {
  border-left-color: var(--pxd-color-status-info-emphasis);
}

/* Settings-style forms: label and help on the left, control on the right. */
@container pxd (width >= 48rem) {
  .pxd-form-horizontal .pxd-field {
    display: grid;
    grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr);
    gap: var(--pxd-space-inline-loose);
    align-items: start;
    padding-bottom: var(--pxd-space-stack-default);
    border-bottom: var(--pxd-border-width-default) solid var(--pxd-color-border-default);
  }
  .pxd-form-horizontal .pxd-field > .pxd-field-label,
  .pxd-form-horizontal .pxd-field > .pxd-field-help {
    grid-column: 1;
  }
  .pxd-form-horizontal .pxd-field > :not(.pxd-field-label):not(.pxd-field-help) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

/* A strip of numbers: three or four tiles across, stacked on phones. */
.pxd-metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--pxd-space-inline-default);
}
.pxd-metric-row .pxd-metric {
  padding: var(--pxd-space-inset-default);
  background: var(--pxd-color-surface-subtle);
  border-radius: var(--pxd-radius-default);
}
