.pfw-field {
  position: relative;
  display: flex;
  min-height: 50px;
  align-items: center;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.pfw-field:focus-within {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgb(34 197 94 / 18%);
}

.pfw-input,
.pfw-mobile-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: 500 16px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pfw-input {
  min-height: 48px;
  padding: 11px 44px 11px 14px;
}

.pfw-clear,
.pfw-mobile-clear,
.pfw-mobile-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.pfw-clear svg,
.pfw-mobile-clear svg,
.pfw-mobile-back svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.pfw-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.pfw-clear:hover,
.pfw-mobile-clear:hover,
.pfw-mobile-back:hover {
  background: #ecfdf5;
  color: #166534;
}

.pfw-clear[hidden],
.pfw-mobile-clear[hidden] {
  display: none;
}

.pfw-listbox,
.pfw-mobile-results {
  box-sizing: border-box;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
  background: #fff;
}

.pfw-listbox {
  position: absolute;
  z-index: 2147482000;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 19rem;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  box-shadow: 0 18px 42px rgb(15 23 42 / 14%);
}

.pfw-option,
.pfw-mobile-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 62px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  color: #0f172a;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.pfw-option:hover,
.pfw-option.is-active,
.pfw-mobile-option:hover,
.pfw-mobile-option.is-active {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.pfw-option-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  max-width: 112px;
  min-height: 30px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.pfw-option-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pfw-option-primary {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pfw-option-secondary {
  overflow: hidden;
  color: #475569;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pfw-message,
.pfw-mobile-message {
  padding: 14px 12px;
  color: #475569;
  font-size: 14px;
}

.pfw-mobile-overlay {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  background: #f8fafc;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 180ms ease, transform 220ms ease, visibility 220ms ease;
  visibility: hidden;
}

.pfw-mobile-overlay.pfw-is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.pfw-mobile-lock {
  overflow: hidden;
}

.pfw-mobile-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  background: #fff;
}

.pfw-mobile-search {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 6px;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding: max(12px, env(safe-area-inset-top)) 12px 12px;
  background: #fff;
}

.pfw-mobile-input {
  min-height: 48px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.pfw-mobile-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgb(34 197 94 / 18%);
}

.pfw-mobile-back,
.pfw-mobile-clear {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

.pfw-mobile-back svg,
.pfw-mobile-clear svg {
  width: 20px;
  height: 20px;
}

.pfw-mobile-results {
  max-height: none;
  padding: 10px 12px max(20px, env(safe-area-inset-bottom));
}

.pfw-mobile-option {
  min-height: 66px;
  border-color: #e2e8f0;
  border-radius: 8px;
  padding: 10px;
}

.pfw-mobile-option + .pfw-mobile-option {
  margin-top: 8px;
}

@media (max-width: 640px) {
  .pfw-listbox {
    max-height: min(18rem, 52vh);
  }

  .pfw-option,
  .pfw-mobile-option {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .pfw-option-type {
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    min-height: 26px;
    padding: 0 10px;
  }
}
