body {
  -webkit-font-smoothing: antialiased;
}

/* Match body offset to fixed `.pues-topbar` (config `pues-topbar-height`). */
:root {
  --pues-topbar-height: 65px;
}
#root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  margin: 0 auto;
}

/* Detail pages (source groups, All Errors) — bounded scroll region. */
.app-detail-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.screen-loading {
  padding: 24px;
  text-align: center;
  color: var(--pues-text-secondary);
}

.app-root-panel--hidden {
  display: none;
}

.quota-badge {
  background: var(--pues-bg-raised);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--pues-text-primary);
  transition: background 0.15s ease, color 0.15s ease;
}
.quota-badge:hover {
  background: var(--pues-bg-raised-hover);
  color: var(--pues-text-primary);
}
.quota-badge--low {
  background: var(--pues-danger-active);
  color: var(--pues-on-accent);
}
.quota-badge--low:hover {
  background: var(--pues-danger);
  color: var(--pues-on-accent);
}

/* Badges (docs/CONCEPT.md §Lifecycle & badges): red = regressed unresolved,
 * yellow = new unresolved. Fixed colors, identical in light/dark theme. */
.badge {
  border-radius: 9999px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.badge + .badge {
  margin-left: 6px;
}
.badge--regressed {
  background: var(--pues-danger);
  color: var(--pues-on-accent);
}
.badge--new {
  background: #fbbf24;
  color: #451a03;
}

/* Group status pill in list rows and the sample dialog. */
.group-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  vertical-align: middle;
}
/* In list rows the pill optically sits 2px low against the meta text. */
.list-item-meta .group-status {
  position: relative;
  top: -2px;
}
.group-status--new {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}
.group-status--regressed {
  background: #ffe4e6;
  color: #be123c;
  border-color: #fda4af;
}
.group-status--resolved {
  background: var(--pues-bg-raised);
  color: var(--pues-text-muted);
  border-color: var(--pues-border-default);
}

/* Lists */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--pues-border-default);
  cursor: pointer;
  background: var(--pues-bg-surface);
  min-height: 56px;
}
.list-item:active {
  background: var(--pues-bg-raised);
}
.list-item-content {
  flex: 1;
  min-width: 0;
}
.list-item-title {
  font-weight: 500;
  color: var(--pues-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-meta {
  font-size: 14px;
  color: var(--pues-text-secondary);
  margin-top: 7px;
}
.list-item--no-border {
  border-bottom: none;
}
.list-item-content--indent {
  margin-left: 8px;
}

/* Swipe rows (home sources + error groups) */
.row-wrap {
  list-style: none;
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--pues-border-default);
}
.row-slider {
  display: flex;
  width: 100%;
  transition: transform 0.15s ease-out;
  touch-action: pan-y;
}
.row-edit {
  flex-shrink: 0;
  width: 72px;
  padding: 0 8px;
  border: none;
  border-radius: 0;
  background: var(--pues-bg-raised-hover);
  color: var(--pues-on-accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-edit:hover {
  background: var(--pues-text-muted);
}
.row-edit:active {
  background: var(--pues-bg-raised);
}
.row-delete,
.row-resolve {
  flex-shrink: 0;
  width: 72px;
  padding: 0 8px;
  border: none;
  border-radius: 0;
  background: var(--pues-danger);
  color: var(--pues-on-accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-delete:hover {
  background: var(--pues-danger-hover);
}
.row-delete:active {
  background: var(--pues-danger-active);
}
.row-resolve {
  background: var(--pues-success);
}

/* Dialog form controls (config, settings) */
.pues-dialog-select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 2.75rem 10px 14px;
  border: 1px solid var(--pues-border-default);
  border-radius: 8px;
  color: var(--pues-text-muted);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  /* Layer chevron above fill — single background shorthand drops the arrow on some engines */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath stroke='%23a8b4c4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M7 10l5 5 5-5'/%3E%3C/svg%3E")
      no-repeat right 12px center / 18px 18px,
    var(--pues-bg-page);
}
.pues-dialog-select:focus {
  outline: none;
  border-color: var(--pues-border-strong);
}
.pues-dialog-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pues-dialog-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid var(--pues-border-default);
  border-radius: 8px;
  background: var(--pues-bg-page);
  color: var(--pues-text-primary);
  font-size: 14px;
  line-height: 1.4;
}
.pues-dialog-input::placeholder {
  color: var(--pues-text-muted);
}
.pues-dialog-input:focus {
  outline: none;
  border-color: var(--pues-border-strong);
}

.empty-state-hint {
  padding: 16px;
  color: var(--pues-text-muted);
  text-align: center;
  margin: 0;
}
.dialog-lede {
  margin: 0 0 16px;
}
.form-button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.form-button-row--end {
  justify-content: flex-end;
}

/* Detail scroll region — header + filter chips inside the scroller, pinned
   sticky together, frosted. */
.groups-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.detail-sticky-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in oklab, var(--pues-bg-surface) 52%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in oklab, var(--pues-border-default) 55%, transparent);
}
@supports not (background: color-mix(in lab, red, blue)) {
  .detail-sticky-header {
    background: rgba(30, 41, 59, 0.52);
    border-bottom-color: rgba(51, 65, 85, 0.55);
  }
}

.groups-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  color: var(--pues-text-secondary);
  font-size: 14px;
}
/* Sits beside the filter chips; chip-scale, never wraps. */
.clear-resolved-btn {
  white-space: nowrap;
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 14px;
}

/* Status filter chips (all/open/regressed/resolved) — fifos-style active
   fills over the neutral pues skeleton. */
.pues-chip--all.pues-chip--active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #bfdbfe;
}
.pues-chip--open.pues-chip--active {
  background: #713f12;
  border-color: #713f12;
  color: #fef08a;
}
.pues-chip--regressed.pues-chip--active {
  background: #7f1d1d;
  border-color: #7f1d1d;
  color: #fecaca;
}
.pues-chip--resolved.pues-chip--active {
  background: #334155;
  border-color: #334155;
  color: #cbd5e1;
}

.group-sample {
  max-height: 40vh;
  overflow: auto;
}

.pues-icon-btn {
  padding: 6px;
}
.list-url {
  font: inherit;
  font-size: 12px;
  color: var(--pues-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-url:hover:not(:disabled) {
  color: var(--pues-text-secondary);
}
.list-url:disabled {
  opacity: 0.6;
  cursor: default;
}
.copied-badge {
  font-size: 11px;
  color: var(--pues-success);
  flex-shrink: 0;
}
