/* The relative form: one column of labelled fields, the app's own controls, no WordPress chrome. */

#akashic-health-records-patient-portal-root .ahr-fmh--flat {
  border: 0;
  box-shadow: none;
}

#akashic-health-records-patient-portal-root .ahr-fmh-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#akashic-health-records-patient-portal-root .ahr-fmh-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  outline: none;
}

#akashic-health-records-patient-portal-root .ahr-fmh-fieldset {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#akashic-health-records-patient-portal-root label.ahr-fmh-label,
#akashic-health-records-patient-portal-root legend.ahr-fmh-label {
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-fmh-required {
  margin-left: 2px;
  color: var(--destructive);
}

#akashic-health-records-patient-portal-root .ahr-fmh-select {
  width: 100%;
}

#akashic-health-records-patient-portal-root .ahr-fmh-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#akashic-health-records-patient-portal-root .ahr-fmh-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

#akashic-health-records-patient-portal-root p.ahr-fmh-error {
  margin: 0;
  font-size: 13px;
  color: var(--destructive);
}

#akashic-health-records-patient-portal-root p.ahr-fmh-hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root p.ahr-fmh-subhead {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-fmh-tabs {
  margin-top: 8px;
}

#akashic-health-records-patient-portal-root .ahr-fmh-tabs [role="tablist"] {
  max-width: 100%;
  overflow-x: auto;
}

#akashic-health-records-patient-portal-root .ahr-fmh-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 12px;
}

#akashic-health-records-patient-portal-root .ahr-fmh-condition {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--ak-card-radius);
}

#akashic-health-records-patient-portal-root .ahr-fmh-condition-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#akashic-health-records-patient-portal-root button.ahr-fmh-add {
  align-self: flex-start;
}

#akashic-health-records-patient-portal-root .ahr-fmh-note,
#akashic-health-records-patient-portal-root .ahr-fmh-reference {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#akashic-health-records-patient-portal-root .ahr-fmh-reference > .ahr-fmh-field {
  flex: 1;
}

#akashic-health-records-patient-portal-root .ahr-fmh-chips,
#akashic-health-records-patient-portal-root .ahr-fmh-matches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#akashic-health-records-patient-portal-root .ahr-fmh-matches {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

#akashic-health-records-patient-portal-root .ahr-fmh-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--blue-soft);
  font-size: 13px;
  color: var(--ink);
}

#akashic-health-records-patient-portal-root button.ahr-fmh-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}

#akashic-health-records-patient-portal-root button.ahr-fmh-match {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  font-size: 14px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

#akashic-health-records-patient-portal-root button.ahr-fmh-match:hover,
#akashic-health-records-patient-portal-root button.ahr-fmh-match:focus-visible {
  background: var(--blue-soft);
}

@media (max-width: 480px) {
  #akashic-health-records-patient-portal-root .ahr-fmh-reference {
    flex-wrap: wrap;
  }
}
