/* Text field, textarea, select, secret field, configured-elsewhere field and
   the form-level error summary. Label above, help below.
   States: empty, filled, hover, focus, error (aria-invalid), disabled (dashed),
   read-only (no fill); secret: stored, replacing. */

.pr-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pr-label { font-size: 0.85rem; line-height: 1.4; font-weight: 500; color: var(--pr-text-primary); display: flex; gap: 6px; align-items: center; }
.pr-label__req { color: var(--pr-text-caption); font-weight: 400; font-size: 0.75rem; }
.pr-help { font-size: 0.75rem; line-height: 1.4; color: var(--pr-text-caption); }
.pr-field__err { font-size: 0.75rem; line-height: 1.4; color: var(--pr-danger-text); display: flex; gap: var(--pr-space-xs); align-items: flex-start; font-weight: 500; }
.pr-field__err .pr-ico { margin-top: 1px; }
.pr-field__row { display: flex; align-items: center; gap: var(--pr-space-sm); }
.pr-field__unit { font-size: 0.85rem; color: var(--pr-text-secondary); white-space: nowrap; }

/* The one field shell: a native input, select or textarea carries .pr-input;
   a field with an icon wraps the native control in .pr-input--affix. */
.pr-input {
  display: flex; align-items: center; gap: var(--pr-space-sm);
  width: 100%; min-width: 0;
  height: var(--pr-density-standard-control);
  padding: 0 var(--pr-space-md);
  border-radius: var(--pr-radius-sm);
  border: var(--pr-border-hairline) solid var(--pr-border-control);
  background: var(--pr-surface-nested);
  color: var(--pr-text-primary);
  font: 400 0.85rem/1.3 var(--font-sans);
  transition: border-color var(--pr-dur-fast) var(--pr-ease-standard);
}
.pr-input::placeholder, .pr-input__ph { color: var(--pr-text-caption); opacity: 1; }
.pr-input:hover, .pr-input.is-hover { border-color: var(--pr-text-secondary); }
.pr-input:focus-visible, .pr-input.is-focus,
.pr-input--affix:focus-within { outline: var(--pr-border-focus) solid var(--pr-focus-ring); outline-offset: var(--pr-border-focus); }
textarea.pr-input, .pr-input--area { height: auto; min-height: 88px; padding: 10px var(--pr-space-md); align-items: flex-start; line-height: 1.45; resize: vertical; }
.pr-input--dense { height: var(--pr-density-dense-control); }
.pr-input--mono { font-family: var(--font-mono); }

.pr-input--affix > .pr-ico { color: var(--pr-text-secondary); }
.pr-input__control {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; padding: 0; margin: 0;
  background: transparent; color: inherit; font: inherit;
}
.pr-input__control::placeholder { color: var(--pr-text-caption); opacity: 1; }

/* Error: a second inset line in danger text, plus the octagon and message. */
.pr-input.is-error, .pr-input[aria-invalid="true"],
.pr-input--affix:has(> [aria-invalid="true"]) { border-color: var(--pr-danger-text); box-shadow: inset 0 0 0 1px var(--pr-danger-text); }

/* Disabled is dashed; read-only has no fill; configured elsewhere is dashed with a lock and stays readable. */
.pr-input[disabled], .pr-input.is-disabled,
.pr-input--affix:has(> [disabled]) { color: var(--pr-text-disabled); border-style: dashed; cursor: not-allowed; }
.pr-input[readonly], .pr-input--readonly { background: none; border-color: var(--pr-border-default); }
.pr-input--locked { background: none; border-style: dashed; border-color: var(--pr-border-control); color: var(--pr-text-primary); }
.pr-input--readonly > .pr-ico, .pr-input--locked > .pr-ico { color: var(--pr-text-secondary); }

/* Native select with its own chevron */
.pr-select { position: relative; display: block; min-width: 0; }
.pr-select > select.pr-input { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.pr-select > select.pr-input[disabled] { cursor: not-allowed; }
.pr-select__chev { position: absolute; right: var(--pr-space-md); top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--pr-text-secondary); }
.pr-select > select.pr-input option { background: var(--pr-surface-elevated); color: var(--pr-text-primary); }

/* Secret field: a stored credential is never shown again. */
.pr-secret { display: flex; align-items: center; gap: var(--pr-space-sm); }
.pr-secret > .pr-input { flex: 1; }
.pr-secret__stored { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.04em; }

/* Form-level error summary: one sentence per field, each name moves focus to it. */
.pr-errsum {
  border-radius: var(--pr-radius-md);
  padding: var(--pr-space-md) var(--pr-space-lg);
  background: var(--pr-danger-tint);
  box-shadow: inset 0 0 0 1px var(--pr-danger-text);
  font-size: 0.85rem; line-height: 1.45;
  color: var(--pr-text-primary);
}
.pr-errsum__t { font-weight: 600; display: flex; gap: var(--pr-space-sm); align-items: center; }
.pr-errsum__t .pr-ico { color: var(--pr-danger-text); }
.pr-errsum ul { margin: var(--pr-space-xs) 0 0; padding-left: 28px; }

@media (max-width: 768px) {
  /* 16px type stops iOS zoom; 48px controls */
  .pr-input { height: 48px; font-size: 1rem; }
  textarea.pr-input, .pr-input--area { height: auto; }
  .pr-secret { flex-wrap: wrap; }
  .pr-secret > .pr-input { flex: 1 1 100%; }
  .pr-secret > .pr-btn { flex: 1 1 100%; }
}
