.profile-form {
  display: grid;
  gap: 16px;
  max-width: 660px;
}

.profile-form[hidden] {
  display: none;
}

.profile-field {
  display: grid;
  gap: 7px;
}

.profile-field label {
  color: #4e5d50;
  font-weight: 700;
}

.profile-field input,
.profile-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.profile-field input[readonly] {
  background: #f5f3ed;
  color: #59645b;
}

.profile-field.is-invalid input,
.profile-field.is-invalid select {
  border-color: #c65d49;
  background: #fff8f6;
}

.field-error,
.field-note,
.profile-save-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.field-error {
  color: #8a3324;
}

.profile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.profile-actions .summary-button {
  width: auto;
  min-width: 160px;
  padding-right: 22px;
  padding-left: 22px;
  cursor: pointer;
}

.profile-actions .summary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.profile-save-message {
  color: #315c2e;
  font-weight: 700;
}

.account-status.auth-required button {
  cursor: pointer;
}

@media (max-width: 560px) {
  .profile-actions {
    display: grid;
  }

  .profile-actions .summary-button {
    width: 100%;
  }
}

.account-page {
  background: linear-gradient(180deg, #edf4e9 0%, #f8f5ed 42%, #fbf9f2 100%);
}

.profile-field input,
.profile-field select {
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-md);
  background: var(--storefront-surface-raised);
}

.profile-field input[readonly] {
  background: var(--storefront-bg-soft);
}

.profile-actions .summary-button {
  border-radius: var(--storefront-radius-md);
}

body:has(#profileForm) .account-content {
  padding: 26px;
}

body:has(#profileForm) .account-head {
  margin-bottom: 18px;
}

body:has(#profileForm) .account-status {
  padding: 22px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
}

body:has(#profileForm) .account-status.auth-required {
  max-width: 680px;
}

body:has(#profileForm) .profile-form {
  max-width: 720px;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
}

body:has(#profileForm) .profile-field {
  gap: 8px;
}

body:has(#profileForm) .profile-field label {
  color: var(--storefront-text-soft);
  font-family: var(--storefront-heading-font-family);
  font-size: 0.94rem;
  line-height: 1.2;
}

body:has(#profileForm) .profile-field input,
body:has(#profileForm) .profile-field select {
  min-height: 50px;
  padding-right: 15px;
  padding-left: 15px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-md);
  background: var(--storefront-surface-raised);
  color: var(--storefront-text);
  box-shadow: none;
}

body:has(#profileForm) .profile-field input[readonly] {
  border-color: #e2ded4;
  background: var(--storefront-bg-soft);
  color: var(--storefront-muted);
}

body:has(#profileForm) .profile-field input:focus,
body:has(#profileForm) .profile-field select:focus {
  border-color: var(--storefront-accent);
  box-shadow: var(--storefront-focus);
  outline: 0;
}

body:has(#profileForm) .profile-field.is-invalid input,
body:has(#profileForm) .profile-field.is-invalid select {
  border-color: #c45a4a;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(196, 90, 74, 0.1);
}

body:has(#profileForm) .field-error,
body:has(#profileForm) .field-note,
body:has(#profileForm) .profile-save-message {
  font-size: 0.9rem;
}

body:has(#profileForm) .field-error {
  color: var(--storefront-danger);
  font-weight: 700;
}

body:has(#profileForm) .field-note {
  color: var(--storefront-muted);
}

body:has(#profileForm) .profile-actions {
  align-items: center;
  gap: 14px;
  margin-top: 2px;
  padding-top: 18px;
  border-top: 1px solid #e8e5da;
}

body:has(#profileForm) .profile-actions .summary-button {
  min-width: 178px;
  min-height: 48px;
  border-radius: var(--storefront-radius-md);
}

body:has(#profileForm) .profile-save-message {
  padding: 8px 12px;
  border: 1px solid #d7e5cf;
  border-radius: var(--storefront-radius-md);
  background: #f1f8ed;
  color: #315c2e;
}

body:has(#profileForm) .profile-save-message[hidden] {
  display: none;
}

@media (max-width: 860px) {
  body:has(#profileForm) .account-content {
    padding: 20px;
  }

  body:has(#profileForm) .account-head {
    margin-bottom: 16px;
  }

  body:has(#profileForm) .profile-form {
    max-width: none;
    padding: 18px;
  }
}

@media (max-width: 560px) {
  body:has(#profileForm) .account-content {
    padding: 18px;
  }

  body:has(#profileForm) .profile-form {
    padding: 16px;
  }

  body:has(#profileForm) .profile-actions {
    gap: 10px;
  }

  body:has(#profileForm) .profile-actions .summary-button {
    width: 100%;
  }
}

/* Phase A: account profile spacing consistency. */
body:has(#profileForm) .profile-form {
  gap: 20px;
}

body:has(#profileForm) .profile-field {
  gap: 7px;
}

body:has(#profileForm) .profile-actions {
  gap: 12px;
  padding-top: 20px;
}

body:has(#profileForm) .profile-actions .secondary-button {
  border-color: #ded9cf;
  background: #fffdfa;
  color: var(--storefront-muted);
  box-shadow: none;
}
